Making the handle_error more concise