Do we want special support for error "hints", or long error messages?
See #578 (closed): I want to display a much longer message on a given failure type when its facing the user. But how to do it? The desired message is significantly larger than a typical developer-facing error message.
Some possibilities include:
- Introduce an
ErrorHint
trait, or something, plus machinery to recursively inspect all our errors. (IMO this would be a pain without macro support, since we can't recurse onError::source
and probe whether eachError
implementsErrorHint
.) - Mess around with the alternative formatter code, and display our errors with
{:#}
when they are going to a human. (This might require some fooling around withthiserror
, and might not even work.) - Dispatch based on the
ErrorKind
value, and require that anyErrorKind
with a hint should only appear when that hint is appropriate. - Add a "hint" field to
ErrorKind
, with type Option. (This would make ourErrorKind
construction much nastier. - Bite the bullet, and just declare that our errors sometimes have long messages.
Edited by Ian Jackson