begin generic error handling