News for hackers. Stuff that matters.
Re:Effective Rust by KRAKRISMOTT on Thursday June 15, 2023 @11:37AM (#36342054)
If you are building application software like a web framework, panicking and then dealing with the issue using a global exception handler to return 500 is often the easiest. There was no point in littering the code with match Result => err return http.status500 like bad Go.
Re:Effective Rust by kaba0 on Thursday June 15, 2023 @11:55AM (#36342341)
(That would be the point of exceptions that make the correct thing the majority of times, and why I think they are superior, checked exceptions that it. They are completely analogous to Result types, but are properly supported by the language and can have as small or big scope as needed. I am really hopeful that they will have a resurrection with languages with effects)
Re:Effective Rust by dangerlibrary on Thursday June 15, 2023 @12:21PM (#36342833)
This is sometimes called the diaper (anti)pattern - because it catches all the poop. It works great - so long as the only exceptions your program ever throws are ones you are deliberately throwing to the global error handler. Given that, go for it. ;)