mirror of https://github.com/fafhrd91/actix-web
added request path to debug logs
This commit is contained in:
parent
693f6ef541
commit
0e7e799bd4
|
@ -96,7 +96,8 @@ impl<T: 'static, P> FromRequest<P> for Data<T> {
|
||||||
if let Some(st) = req.app_config().extensions().get::<Data<T>>() {
|
if let Some(st) = req.app_config().extensions().get::<Data<T>>() {
|
||||||
Ok(st.clone())
|
Ok(st.clone())
|
||||||
} else {
|
} else {
|
||||||
log::debug!("Failed to construct App-level Data extractor");
|
log::debug!("Failed to construct App-level Data extractor. \
|
||||||
|
Request path: {:?}", req.path());
|
||||||
Err(ErrorInternalServerError(
|
Err(ErrorInternalServerError(
|
||||||
"App data is not configured, to configure use App::data()",
|
"App data is not configured, to configure use App::data()",
|
||||||
))
|
))
|
||||||
|
|
|
@ -179,11 +179,14 @@ where
|
||||||
.map(|c| (c.limit, c.ehandler.clone()))
|
.map(|c| (c.limit, c.ehandler.clone()))
|
||||||
.unwrap_or((32768, None));
|
.unwrap_or((32768, None));
|
||||||
|
|
||||||
|
let path = req.path().to_string();
|
||||||
|
|
||||||
Box::new(
|
Box::new(
|
||||||
JsonBody::new(req, payload)
|
JsonBody::new(req, payload)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.map_err(move |e| {
|
.map_err(move |e| {
|
||||||
log::debug!("Failed to deserialize Json from payload");
|
log::debug!("Failed to deserialize Json from payload. \
|
||||||
|
Request path: {:?}", path);
|
||||||
if let Some(err) = err {
|
if let Some(err) = err {
|
||||||
(*err)(e, &req2)
|
(*err)(e, &req2)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -163,10 +163,7 @@ where
|
||||||
fn from_request(req: &HttpRequest, _: &mut Payload<P>) -> Self::Future {
|
fn from_request(req: &HttpRequest, _: &mut Payload<P>) -> Self::Future {
|
||||||
de::Deserialize::deserialize(PathDeserializer::new(req.match_info()))
|
de::Deserialize::deserialize(PathDeserializer::new(req.match_info()))
|
||||||
.map(|inner| Path { inner })
|
.map(|inner| Path { inner })
|
||||||
.map_err(|| {
|
.map_err(ErrorNotFound)
|
||||||
log::debug!("Failed to deserialize during Path extractor");
|
|
||||||
ErrorNotFound
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,8 @@ where
|
||||||
serde_urlencoded::from_str::<T>(req.query_string())
|
serde_urlencoded::from_str::<T>(req.query_string())
|
||||||
.map(|val| Ok(Query(val)))
|
.map(|val| Ok(Query(val)))
|
||||||
.unwrap_or_else(|e| {
|
.unwrap_or_else(|e| {
|
||||||
log::debug!("Failed during Query extractor deserialization");
|
log::debug!("Failed during Query extractor deserialization. \
|
||||||
|
Request path: {:?}", req.path());
|
||||||
Err(e.into())
|
Err(e.into())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue