@@ -26,25 +26,25 @@ def handle_response(self, response):
2626
2727 Raises:
2828 UnauthorizedException: API token not provided with request
29- ForbiddenException: User is not allowed to access
29+ ForbiddenException: User is not allowed to access resource, or user authorization failure
3030 NotFoundException: Requested object could not be found
31- ConflictException: Resource already exists
31+ ConflictException: Resource already exists, usually duplicate media submission
3232 BadRequestException: Issue with the submitted json, see error message for details
33- ServerException: Unknown error
33+ ServerException: Unknown error, for backend service failure
3434
3535 Returns:
3636 Either the successful response or the appropriate exception is raised
3737 """
3838 if response .status_code in [200 , 201 , 204 ]:
3939 return response
4040 elif response .status_code == 400 :
41- raise BadRequestException (response .text )
41+ raise BadRequestException (response .text if response . text else 'Bad request or validation error.' )
4242 elif response .status_code == 401 :
4343 raise UnauthorizedException ('No user account information supplied.' )
4444 elif response .status_code == 403 :
45- raise ForbiddenException (response .text )
45+ raise ForbiddenException (response .text if response . text else 'Access denied.' )
4646 elif response .status_code == 404 :
47- raise NotFoundException (response .text )
47+ raise NotFoundException (response .text if response . text else 'Resource not on file.' )
4848 elif response .status_code == 409 :
4949 raise ConflictException ("Conflict, URL or file is already associated with this record." )
5050 else : # 500
0 commit comments