tokio-rs / valuable

MIT License
185 stars 19 forks source link

Consider changing Value::Error to &(dyn Error + 'static) #58

Closed KodrAus closed 2 years ago

KodrAus commented 3 years ago

The current error variant in Value::Error is a plain &dyn Error, which unfortunately doesn't support downcasting. It might be worth changing this to &(dyn Error + 'static), which seems to be a reasonably accepted restriction on the type to support any scenario a consumer might have.

hawkw commented 2 years ago

+1 on this; &(dyn Error + 'static) will also allow the use of Error::source instead of the deprecated Error::cause. Right now, the fact that error cause chains can only be traversed by calling a deprecated method is kind of a shame...