AVOID USING TRY/CATCH FOR FLOW CONTROL!!!!
- https://softwareengineering.stackexchange.com/a/107760
- https://web.archive.org/web/20140430044213/http://c2.com/cgi-bin/wiki?DontUseExceptionsForFlowControl
If you don't know what to do with it, handle it in a decent manner at least:
It is also a costy abstraction when comes to a performance point of view in most languages:
- Js: https://stackoverflow.com/a/34485577
- C#: https://stackoverflow.com/a/4648011
- Java: https://stackoverflow.com/a/4648011
Basic understanding of monads: https://dzone.com/articles/what-is-a-monad-basic-theory-for-a-java-developer
Monads in real life:
- Option/Optional/Maybe (Rust/Java/Scala/Haskell): https://doc.rust-lang.org/std/option/index.html
- Either (Scala): https://www.freecodecamp.org/news/a-survival-guide-to-the-either-monad-in-scala-7293a680006/
- Result (Rust): https://doc.rust-lang.org/rust-by-example/error/result.html
- Try (Scala): https://medium.com/@shantanukamath/why-try-scala-error-handling-d71d2bd44d8c
- Pattern match with tuples (Elixir): https://medium.com/@moxicon/elixir-best-practices-for-error-values-50dc015a06f5
- Stream (Java): https://dzone.com/articles/whats-wrong-java-8-part-iii
- Errors are values: https://go.dev/blog/errors-are-values
- Defensive vs Offensive Programming: https://interrupt.memfault.com/blog/defensive-and-offensive-programming
- Erlang's let-it-crash: https://www.amberbit.com/blog/2019/7/26/the-misunderstanding-of-let-it-crash/
Good thread about error handling: https://twitter.com/badamczewski01/status/1427249691650150409