DEV Community

Discussion on: The fight between Try-Catch and If-Else

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

You must know what your program should do, and that is possible to a couple of intentions, this is all covered by if else. But, your program might want to do something you didn't anticipate, this is where error catching comes in. Although this isn't the hardest question, should you reroute an error back to expected behaviour? Should you let it fall over in a blanket ah snap, or let it fall over and record a specific error, how should you log and when... It gets quite complex very quickly.