cleanup error handling for custom exception types