try: user = get_user(user_id) except (TypeError, ValueError): self.add_error_message("The user was incorrect.") except APINotFoundError: self.add_error_message("The user was not found.") except (APINotAuthorizedError, APIForbiddenError): self.add_error_message("You are not authorized to access this.") except APIError: self.add_error_message("There was an unexpected error getting the user.")