slog-rs/slog

Add support for `dyn Error` references

demurgos opened this issue · 2 comments

The PR #327 adds support for error references. Unfortunately it's missing support for dyn Error. Error trait objects are fairly common so it's unfortunate that it's not supported, we should try to add support for it.

As far as I know, using an owned trait object (Box<dyn Error>) should work fine with the existing ErrorValue. The only problem is using a borrowed &dyn Error with the new ErrorRef.

Please let me know if this is incorrect.

Ah, we need to change the bound to E: ?Sized + std::error::Error (and add a new test for this scenario).