Closed fschutt closed 6 years ago
It's correct. It matches https://doc.rust-lang.org/std/error/trait.Error.html#tymethod.description, which returns a &str
.
I know the cause. However, I don't see why error_chain has to stick with the std::Error here. Notice, that the description
method does not require the &str
to be 'static
. It could take a Formatter instead (which would not break any existing code), so that you could print some dynamic value in the description. The upside to this would be that you don't get a cryptic error anymore. The downside would be ... performance? But then again, printing errors is not something you do very often.
Well it's a design problem in my view. Closing because it's not really a bug, however it should be kept for Google searches.
https://play.rust-lang.org/?gist=5091717006ad7e3c32358f236b4e3459&version=stable
If you omit the
{}
in the formatting string, it will work correctly.{}
is only allowed indisplay
, which is not documented (as far as I can see). Is this intentional?The error:
... is fairly cryptic. It may be useful to either put a warning into the docs or let
description
accept a formatting string, likedisplay
for consistency.