Error handling is a fundamental aspect of programming. Unless you are writing “hello world”, you will need to handle errors in your code. In this post, I will discuss a bit the most common approaches used by various programming languages. Return error codes This is one of the most ancient strategies - if a function can fail, it can simply return an error code - often a negative number, or null.