Add error handler which prints the error message