You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, Error represents an error where no information can be extracted from it unless it is pattern-matched explicitly against a known collection of possible errors. (Please correct me if I'm wrong.)
What if Error and all custom error types created by type! were forced to provide a to_string method so that no matter what kind of error happens, information can be shown to the user about the specific error?
Wouldn't this dramatically simplify all error handling by enabling all functions that might error to simply return T!Error and then at some point up the call chain the error can be handled and to_string() can be called to report the error?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently,
Error
represents an error where no information can be extracted from it unless it is pattern-matched explicitly against a known collection of possible errors. (Please correct me if I'm wrong.)What if
Error
and all custom error types created bytype!
were forced to provide ato_string
method so that no matter what kind of error happens, information can be shown to the user about the specific error?Wouldn't this dramatically simplify all error handling by enabling all functions that might error to simply return
T!Error
and then at some point up the call chain the error can be handled andto_string()
can be called to report the error?Beta Was this translation helpful? Give feedback.
All reactions