Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling when the folder type is not dynamic folder #398

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cloudinary/api_client/execute_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,13 @@ def execute_request(http_connector, method, params, headers, auth, api_url, **op
raise GeneralError("Unexpected error %s" % str(e))
except socket.error as e:
raise GeneralError("Socket Error: %s" % str(e))
except Exception as e:
raise GeneralError("API is only supported on dynamic folders please check your folder mode on https://console.cloudinary.com/pm/developer-dashboard Error:%s " % str(e))

try:
result = json.loads(body.decode('utf-8'))
except Exception as e:
# Error is parsing json
raise GeneralError("Error parsing server response (%d) - %s. Got - %s" % (response.status, body, e))
raise GeneralError("API is only supported on dynamic folders please check your folder mode on https://console.cloudinary.com/pm/developer-dashboard Error:%s " % str(e))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There can be different reasons to get a general error, not related to dynamic folders, this message will be misleading in all other use cases. We will open an issue for our backend team, the correct error should come back from our servers.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh got it. Should I make any changes or wait?

thanks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@someshfengde you can close this PR, since it's not related to the SDK.
@tommyg-cld will pass the issue to the backend team.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks,

got it :)


if "error" in result:
exception_class = EXCEPTION_CODES.get(response.status) or Exception
Expand Down