handling errors on the application