Re:Eris – A better way to handle, trace, and log errors in Go
by status_quo69 on Wednesday December 25, 2019 @09:10PM
(#21881654)
Or you can use a boxed error iirc. Matching on the type of error after you do that isn't exactly great but it's doable if all you want to do is bubble the error up.
Places where that approach really sucks include web api routes (unless I haven't figured out a trick yet). For example, rocket defines Responder on Result so long as the ok and error variants both define it, but since a boxed error is erased it doesn't function correctly.
And if you think about it, defining those operator is a good practice as it tells your program how to handle errors.