Handling different types of errors