Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print unconfigured Data<T> type when attempting extraction #1743

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

## Unreleased - 2020-xx-xx
* Implement Logger middleware regex exclude pattern [#1723]
* Print unconfigured `Data<T>` type when attempting extraction. [#1743]

[#1723]: https://github.com/actix/actix-web/pull/1723
[#1743]: https://github.com/actix/actix-web/pull/1743

## 3.1.0 - 2020-09-29
### Changed
Expand Down
6 changes: 4 additions & 2 deletions src/data.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::any::type_name;
use std::ops::Deref;
use std::sync::Arc;

Expand Down Expand Up @@ -121,8 +122,9 @@ impl<T: ?Sized + 'static> FromRequest for Data<T> {
} else {
log::debug!(
"Failed to construct App-level Data extractor. \
Request path: {:?}",
req.path()
Request path: {:?} (type: {})",
req.path(),
type_name::<T>(),
);
err(ErrorInternalServerError(
"App data is not configured, to configure use App::data()",
Expand Down