4 ms·
How many errors are actually recoverable. I bet most thrown exceptions could be replaced with a printf(“it went wrong here”) for all their utility.
by pinoy420 2y ago
How many errors are actually recoverable. I bet most thrown exceptions could be replaced with a printf(“it went wrong here”) for all their utility.
- The_Colonel 2y agoWell, usually you want to handle it at some level - e.g. a common REST exception handler returning a standard 500 response with some details about what went wrong. Or retry the process (sometimes the errors may be intermittent)
- bluGill 2y agoI disagree. The real value of exceptions is you can skip 6 levels of functions that have lines like status = DoThing(); if(status != allIsWell) {return status;} C++ embedded for a long time has said don't use exceptions they are slow. However recent thinking has changed - turns out in trivial code exceptions are slow but in more real world code exceptions are faster than all those layers if checks - and better yet you won't give up on writing all the if checks. Thus embedded projects are starting turn exceptions on (often optimized exceptions with static pre allocated buffers) The final "print something when wrong" is of little value, but the unwinding is very valuable.
- hasley 2y agoDo you have any references for that? I used to avoid exceptions on small Cortex M0/M3 devices as well.
- ackfoobar 2y ago> The real value of exceptions is you can skip 6 levels of functions that have lines like For some reason some Go programmers think those lines are the best thing since sliced bread.