More generic error handling.