Shit happens

Errors happen.  It is inevitable that eventually your program will try to do something that won't succeed.  There will not be enough memory, that file will not be there on the disk, and so on.  If your program doesn't actually do anything important, you may just let it crash.  However if there is some requirement of reliability, you will have to detect this error and somehow respond to it.

Nowadays the most popular mechanism is exception handling.  However, it is probably worse than the previous approach of returning an error code. 

Sources: Back to the top