diff --git a/src/lib.rs b/src/lib.rs index 92bf691..a45dc83 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -338,11 +338,14 @@ openapi = ["gotham-restful/openapi"] into your libraries `Cargo.toml` and use the following for all types used with handlers: ``` +# #[cfg(feature = "openapi")] +# mod openapi_feature_enabled { # use gotham_restful::OpenapiType; # use serde::{Deserialize, Serialize}; #[derive(Deserialize, Serialize)] #[cfg_attr(feature = "openapi", derive(OpenapiType))] struct Foo; +# } ``` # Examples diff --git a/src/result/mod.rs b/src/result/mod.rs index 100ba55..2c79d37 100644 --- a/src/result/mod.rs +++ b/src/result/mod.rs @@ -104,8 +104,17 @@ where E: Display + IntoResponseError { into_response_helper(|| { - errorlog(&e); - e.into_response_error() + let msg = e.to_string(); + let res = e.into_response_error(); + match &res { + Ok(res) if res.status.is_server_error() => errorlog(msg), + Err(err) => { + errorlog(msg); + errorlog(&err); + }, + _ => {} + }; + res }) }