mirror of https://github.com/fafhrd91/actix-web
Add support for anyhow
This commit is contained in:
parent
7bd2270290
commit
267a3f3d58
|
@ -42,7 +42,7 @@ members = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["compress", "failure"]
|
default = ["compress", "failure", "anyhow"]
|
||||||
|
|
||||||
# content-encoding support
|
# content-encoding support
|
||||||
compress = ["actix-http/compress", "awc/compress"]
|
compress = ["actix-http/compress", "awc/compress"]
|
||||||
|
@ -51,6 +51,7 @@ compress = ["actix-http/compress", "awc/compress"]
|
||||||
secure-cookies = ["actix-http/secure-cookies"]
|
secure-cookies = ["actix-http/secure-cookies"]
|
||||||
|
|
||||||
failure = ["actix-http/failure"]
|
failure = ["actix-http/failure"]
|
||||||
|
anyhow = ["actix-http/anyhow"]
|
||||||
|
|
||||||
# openssl
|
# openssl
|
||||||
openssl = ["actix-tls/openssl", "awc/openssl", "open-ssl"]
|
openssl = ["actix-tls/openssl", "awc/openssl", "open-ssl"]
|
||||||
|
|
|
@ -15,7 +15,7 @@ license = "MIT/Apache-2.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
features = ["openssl", "rustls", "failure", "compress", "secure-cookies"]
|
features = ["openssl", "rustls", "failure", "compress", "secure-cookies", "anyhow"]
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "actix_http"
|
name = "actix_http"
|
||||||
|
@ -36,6 +36,8 @@ compress = ["flate2", "brotli2"]
|
||||||
# failure integration. actix does not use failure anymore
|
# failure integration. actix does not use failure anymore
|
||||||
failure = ["fail-ure"]
|
failure = ["fail-ure"]
|
||||||
|
|
||||||
|
anyhow = ["any-how"]
|
||||||
|
|
||||||
# support for secure cookies
|
# support for secure cookies
|
||||||
secure-cookies = ["ring"]
|
secure-cookies = ["ring"]
|
||||||
|
|
||||||
|
@ -88,6 +90,7 @@ flate2 = { version = "1.0.13", optional = true }
|
||||||
|
|
||||||
# optional deps
|
# optional deps
|
||||||
fail-ure = { version = "0.1.5", package="failure", optional = true }
|
fail-ure = { version = "0.1.5", package="failure", optional = true }
|
||||||
|
any-how = { version="1.0", package="anyhow", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
actix-server = "1.0.0"
|
actix-server = "1.0.0"
|
||||||
|
|
|
@ -36,8 +36,8 @@ pub type Result<T, E = Error> = result::Result<T, E>;
|
||||||
|
|
||||||
/// General purpose actix web error.
|
/// General purpose actix web error.
|
||||||
///
|
///
|
||||||
/// An actix web error is used to carry errors from `failure` or `std::error`
|
/// An actix web error is used to carry errors from `anyhow`, `failure`, or
|
||||||
/// through actix in a convenient way. It can be created through
|
/// `std::error` through actix in a convenient way. It can be created through
|
||||||
/// converting errors with `into()`.
|
/// converting errors with `into()`.
|
||||||
///
|
///
|
||||||
/// Whenever it is created from an external object a response error is created
|
/// Whenever it is created from an external object a response error is created
|
||||||
|
@ -967,6 +967,10 @@ where
|
||||||
/// Compatibility for `failure::Error`
|
/// Compatibility for `failure::Error`
|
||||||
impl ResponseError for fail_ure::Error {}
|
impl ResponseError for fail_ure::Error {}
|
||||||
|
|
||||||
|
#[cfg(feature = "anyhow")]
|
||||||
|
/// Compatibility for `anyhow::Error`
|
||||||
|
impl ResponseError for any_how::Error {}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
Loading…
Reference in New Issue