It would be great to be able to match by an error type without the need to downcast errors from anyhow::Error.
Atm, it's impossible to know the range of possible errors in DisconnectReason::ByError, which makes it difficult for users to make an informed decision on what they should handle or not.
It's also a better practice for libraries to expose errors as matchable enums, whereas anyhow is advised to be used only in applications or private modules when users don't care about specific error types.
A similar issue was originally opened in lightyear, as it inherits the same problem of being unable to match by exact error type, and then also exaggerates it by casting anyhow::Error to a string via debug-printing cBournhonesque/lightyear#1704. But to fix the problem altogether in lightyear, I hope this issue can also be addressed on the aeronet end.
It would be great to be able to match by an error type without the need to downcast errors from
anyhow::Error.Atm, it's impossible to know the range of possible errors in
DisconnectReason::ByError, which makes it difficult for users to make an informed decision on what they should handle or not.It's also a better practice for libraries to expose errors as matchable enums, whereas
anyhowis advised to be used only in applications or private modules when users don't care about specific error types.A similar issue was originally opened in
lightyear, as it inherits the same problem of being unable to match by exact error type, and then also exaggerates it by castinganyhow::Errorto a string via debug-printing cBournhonesque/lightyear#1704. But to fix the problem altogether inlightyear, I hope this issue can also be addressed on theaeronetend.