3 ms·
I would say that the beauty of error codes is precisely that it is an evil that is easily visible, whereas exceptions lurk in the shadows. Error codes are like
by fxtentacle 7y ago
I would say that the beauty of error codes is precisely that it is an evil that is easily visible, whereas exceptions lurk in the shadows.
Error codes are like someone suggesting "lets blow this thing up" and you can either follow their advice or ignore it.
Exceptions are more like someone throwing you an unlocked grenade. Unless you expect them to be that irresponsible and unless you actively react to their behavior, things explode.
I once had to debug an issue with a Java app that did not throw exceptions anywhere, but it did use the Hibernate ERM framework and somewhere deep inside Hibernate there was a bytecode patching library used which didn't like our custom build of the VM and produce a class-less unchecked exception which would crash the app.
And in my experience, the people that do bad error handling with return codes are also the same people that catch an Exception and rethrow it wrapped in a RuntimeException to remove all that try/catch bloat. It's laziness in either case.