Re:Beginner's guide to error handling in Rust
by the_gipsy on Sunday July 10, 2022 @01:51PM
(#32047010)
errors.Is only works if you have an actual ErrorType which you have to manually hunt down only to find it's a fmt.Errof and it doesn't work.
[ Parent
| on HN ]
Re:Beginner's guide to error handling in Rust
by c7DJTLrn on Sunday July 10, 2022 @02:09PM
(#32047224)
It's rarely the case that you need to know exactly where the error originated. You just need to check if the error wraps a network error or EOF error for example.
If you do need to know specifically what the error was then the API provides public error types.
Re:Beginner's guide to error handling in Rust
by the_gipsy on Sunday July 10, 2022 @04:42PM
(#32048784)
No, "the API" doesn't. I have encountered many libs that just do fmt.Errof, and just like that application code does too.
So go doesn't do error handling well at all. Give your stdlib a stringly error maker, that's what will creep in everywhere. It doesn't matter if there is a section for creating (somewhat) typed errors - half of go code doesn't bother and together with the poor type system you can't even be sure which type of error you got.
Re:Beginner's guide to error handling in Rust
by nindalf on Sunday July 10, 2022 @05:43PM
(#32049376)
I wouldn’t bother replying further. Clearly they’ve got a very strong opinion on this. Multiple people have pointed out the issues with their line of thought but they continue to persist. They’ll understand if they reflect on it, maybe.