mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-26 06:57:43 +02:00
build(deps): update derive_more to v1.0 (#3453)
* build(deps): update derive_more to v1.0 * refactor: use from derive module --------- Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Minimum supported Rust version (MSRV) is now 1.75.
|
||||
|
||||
## 3.5.1
|
||||
|
||||
- Fix WebSocket `Host` request header value when using a non-default port.
|
||||
|
@ -106,7 +106,7 @@ actix-utils = "3"
|
||||
base64 = "0.22"
|
||||
bytes = "1"
|
||||
cfg-if = "1"
|
||||
derive_more = "0.99.5"
|
||||
derive_more = { version = "1", features = ["display", "error", "from"] }
|
||||
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
||||
futures-util = { version = "0.3.17", default-features = false, features = ["alloc", "sink"] }
|
||||
h2 = "0.3.26"
|
||||
|
@ -3,7 +3,7 @@ use std::{fmt, io};
|
||||
use actix_http::error::{HttpError, ParseError};
|
||||
#[cfg(feature = "openssl")]
|
||||
use actix_tls::accept::openssl::reexports::Error as OpensslError;
|
||||
use derive_more::{Display, From};
|
||||
use derive_more::derive::{Display, From};
|
||||
|
||||
use crate::BoxError;
|
||||
|
||||
@ -12,40 +12,40 @@ use crate::BoxError;
|
||||
#[non_exhaustive]
|
||||
pub enum ConnectError {
|
||||
/// SSL feature is not enabled
|
||||
#[display(fmt = "SSL is not supported")]
|
||||
#[display("SSL is not supported")]
|
||||
SslIsNotSupported,
|
||||
|
||||
/// SSL error
|
||||
#[cfg(feature = "openssl")]
|
||||
#[display(fmt = "{}", _0)]
|
||||
#[display("{}", _0)]
|
||||
SslError(OpensslError),
|
||||
|
||||
/// Failed to resolve the hostname
|
||||
#[display(fmt = "Failed resolving hostname: {}", _0)]
|
||||
#[display("Failed resolving hostname: {}", _0)]
|
||||
Resolver(Box<dyn std::error::Error>),
|
||||
|
||||
/// No dns records
|
||||
#[display(fmt = "No DNS records found for the input")]
|
||||
#[display("No DNS records found for the input")]
|
||||
NoRecords,
|
||||
|
||||
/// Http2 error
|
||||
#[display(fmt = "{}", _0)]
|
||||
#[display("{}", _0)]
|
||||
H2(h2::Error),
|
||||
|
||||
/// Connecting took too long
|
||||
#[display(fmt = "Timeout while establishing connection")]
|
||||
#[display("Timeout while establishing connection")]
|
||||
Timeout,
|
||||
|
||||
/// Connector has been disconnected
|
||||
#[display(fmt = "Internal error: connector has been disconnected")]
|
||||
#[display("Internal error: connector has been disconnected")]
|
||||
Disconnected,
|
||||
|
||||
/// Unresolved host name
|
||||
#[display(fmt = "Connector received `Connect` method with unresolved host")]
|
||||
#[display("Connector received `Connect` method with unresolved host")]
|
||||
Unresolved,
|
||||
|
||||
/// Connection io error
|
||||
#[display(fmt = "{}", _0)]
|
||||
#[display("{}", _0)]
|
||||
Io(io::Error),
|
||||
}
|
||||
|
||||
@ -66,16 +66,16 @@ impl From<actix_tls::connect::ConnectError> for ConnectError {
|
||||
#[derive(Debug, Display, From)]
|
||||
#[non_exhaustive]
|
||||
pub enum InvalidUrl {
|
||||
#[display(fmt = "Missing URL scheme")]
|
||||
#[display("Missing URL scheme")]
|
||||
MissingScheme,
|
||||
|
||||
#[display(fmt = "Unknown URL scheme")]
|
||||
#[display("Unknown URL scheme")]
|
||||
UnknownScheme,
|
||||
|
||||
#[display(fmt = "Missing host name")]
|
||||
#[display("Missing host name")]
|
||||
MissingHost,
|
||||
|
||||
#[display(fmt = "URL parse error: {}", _0)]
|
||||
#[display("URL parse error: {}", _0)]
|
||||
HttpError(http::Error),
|
||||
}
|
||||
|
||||
@ -86,11 +86,11 @@ impl std::error::Error for InvalidUrl {}
|
||||
#[non_exhaustive]
|
||||
pub enum SendRequestError {
|
||||
/// Invalid URL
|
||||
#[display(fmt = "Invalid URL: {}", _0)]
|
||||
#[display("Invalid URL: {}", _0)]
|
||||
Url(InvalidUrl),
|
||||
|
||||
/// Failed to connect to host
|
||||
#[display(fmt = "Failed to connect to host: {}", _0)]
|
||||
#[display("Failed to connect to host: {}", _0)]
|
||||
Connect(ConnectError),
|
||||
|
||||
/// Error sending request
|
||||
@ -100,26 +100,26 @@ pub enum SendRequestError {
|
||||
Response(ParseError),
|
||||
|
||||
/// Http error
|
||||
#[display(fmt = "{}", _0)]
|
||||
#[display("{}", _0)]
|
||||
Http(HttpError),
|
||||
|
||||
/// Http2 error
|
||||
#[display(fmt = "{}", _0)]
|
||||
#[display("{}", _0)]
|
||||
H2(h2::Error),
|
||||
|
||||
/// Response took too long
|
||||
#[display(fmt = "Timeout while waiting for response")]
|
||||
#[display("Timeout while waiting for response")]
|
||||
Timeout,
|
||||
|
||||
/// Tunnels are not supported for HTTP/2 connection
|
||||
#[display(fmt = "Tunnels are not supported for http2 connection")]
|
||||
#[display("Tunnels are not supported for http2 connection")]
|
||||
TunnelNotSupported,
|
||||
|
||||
/// Error sending request body
|
||||
Body(BoxError),
|
||||
|
||||
/// Other errors that can occur after submitting a request.
|
||||
#[display(fmt = "{:?}: {}", _1, _0)]
|
||||
#[display("{:?}: {}", _1, _0)]
|
||||
Custom(BoxError, Box<dyn fmt::Debug>),
|
||||
}
|
||||
|
||||
@ -130,15 +130,15 @@ impl std::error::Error for SendRequestError {}
|
||||
#[non_exhaustive]
|
||||
pub enum FreezeRequestError {
|
||||
/// Invalid URL
|
||||
#[display(fmt = "Invalid URL: {}", _0)]
|
||||
#[display("Invalid URL: {}", _0)]
|
||||
Url(InvalidUrl),
|
||||
|
||||
/// HTTP error
|
||||
#[display(fmt = "{}", _0)]
|
||||
#[display("{}", _0)]
|
||||
Http(HttpError),
|
||||
|
||||
/// Other errors that can occur after submitting a request.
|
||||
#[display(fmt = "{:?}: {}", _1, _0)]
|
||||
#[display("{:?}: {}", _1, _0)]
|
||||
Custom(BoxError, Box<dyn fmt::Debug>),
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ pub use actix_http::{
|
||||
ws::{HandshakeError as WsHandshakeError, ProtocolError as WsProtocolError},
|
||||
StatusCode,
|
||||
};
|
||||
use derive_more::{Display, From};
|
||||
use derive_more::derive::{Display, From};
|
||||
use serde_json::error::Error as JsonError;
|
||||
|
||||
pub use crate::client::{ConnectError, FreezeRequestError, InvalidUrl, SendRequestError};
|
||||
@ -18,35 +18,35 @@ pub use crate::client::{ConnectError, FreezeRequestError, InvalidUrl, SendReques
|
||||
#[derive(Debug, Display, From)]
|
||||
pub enum WsClientError {
|
||||
/// Invalid response status
|
||||
#[display(fmt = "Invalid response status")]
|
||||
#[display("Invalid response status")]
|
||||
InvalidResponseStatus(StatusCode),
|
||||
|
||||
/// Invalid upgrade header
|
||||
#[display(fmt = "Invalid upgrade header")]
|
||||
#[display("Invalid upgrade header")]
|
||||
InvalidUpgradeHeader,
|
||||
|
||||
/// Invalid connection header
|
||||
#[display(fmt = "Invalid connection header")]
|
||||
#[display("Invalid connection header")]
|
||||
InvalidConnectionHeader(HeaderValue),
|
||||
|
||||
/// Missing Connection header
|
||||
#[display(fmt = "Missing Connection header")]
|
||||
#[display("Missing Connection header")]
|
||||
MissingConnectionHeader,
|
||||
|
||||
/// Missing Sec-Websocket-Accept header
|
||||
#[display(fmt = "Missing Sec-Websocket-Accept header")]
|
||||
#[display("Missing Sec-Websocket-Accept header")]
|
||||
MissingWebSocketAcceptHeader,
|
||||
|
||||
/// Invalid challenge response
|
||||
#[display(fmt = "Invalid challenge response")]
|
||||
#[display("Invalid challenge response")]
|
||||
InvalidChallengeResponse([u8; 28], HeaderValue),
|
||||
|
||||
/// Protocol error
|
||||
#[display(fmt = "{}", _0)]
|
||||
#[display("{}", _0)]
|
||||
Protocol(WsProtocolError),
|
||||
|
||||
/// Send request error
|
||||
#[display(fmt = "{}", _0)]
|
||||
#[display("{}", _0)]
|
||||
SendRequest(SendRequestError),
|
||||
}
|
||||
|
||||
@ -68,13 +68,13 @@ impl From<HttpError> for WsClientError {
|
||||
#[derive(Debug, Display, From)]
|
||||
pub enum JsonPayloadError {
|
||||
/// Content type error
|
||||
#[display(fmt = "Content type error")]
|
||||
#[display("Content type error")]
|
||||
ContentType,
|
||||
/// Deserialize error
|
||||
#[display(fmt = "Json deserialize error: {}", _0)]
|
||||
#[display("Json deserialize error: {}", _0)]
|
||||
Deserialize(JsonError),
|
||||
/// Payload error
|
||||
#[display(fmt = "Error that occur during reading payload: {}", _0)]
|
||||
#[display("Error that occur during reading payload: {}", _0)]
|
||||
Payload(PayloadError),
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ use actix_http::{
|
||||
use actix_http::{encoding::Decoder, header::ContentEncoding, Payload};
|
||||
use actix_rt::time::{sleep, Sleep};
|
||||
use bytes::Bytes;
|
||||
use derive_more::From;
|
||||
use derive_more::derive::From;
|
||||
use futures_core::Stream;
|
||||
use serde::Serialize;
|
||||
|
||||
|
Reference in New Issue
Block a user