Skip to content

Commit

Permalink
Cast response to json in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Leandro Rosemberg committed Aug 20, 2024
1 parent f012d47 commit f391451
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions roboflow/adapters/rfapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ def upload_image(

raise ImageUploadError(err_msg, status_code=response.status_code)
else:
raise ImageUploadError(response, status_code=response.status_code)
raise ImageUploadError(str(response), status_code=response.status_code)

if not responsejson: # fail fast
raise ImageUploadError(response, status_code=response.status_code)
raise ImageUploadError(str(response), status_code=response.status_code)

if not (responsejson.get("success") or responsejson.get("duplicate")):
message = responsejson.get("message") or responsejson
message = responsejson.get("message") or str(responsejson)
raise ImageUploadError(message)

return responsejson
Expand Down Expand Up @@ -236,4 +236,4 @@ def _save_annotation_error(response):
err_msg = err_msg["message"]
return AnnotationSaveError(err_msg, status_code=response.status_code)

return AnnotationSaveError(responsejson, status_code=response.status_code)
return AnnotationSaveError(str(responsejson), status_code=response.status_code)

0 comments on commit f391451

Please sign in to comment.