mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-02-23 04:52:28 +00:00
only log errors on 500 responses (fixes #30)
This commit is contained in:
parent
eeea62859f
commit
d9c22579b0
2 changed files with 14 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue