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 status not mapped properly #464

Closed
Sauloxd opened this issue Sep 14, 2023 · 2 comments
Closed

Error status not mapped properly #464

Sauloxd opened this issue Sep 14, 2023 · 2 comments

Comments

@Sauloxd
Copy link

Sauloxd commented Sep 14, 2023

Hi all! Thanks for you hard work :)

I'm trying to make a "meeting_delete" request to an inexistent ID and I'm seeing a non expected behaviro.
What I expect is for the client to raise a Zoom::NotFound error, as the request status_code is 404.
As I dig a bit into this repository codebase, I found myself in this part:

def raise_if_error!(response, http_code=200)
        return response unless response.is_a?(Hash) && response.key?('code')

        code = response['code']
        error_hash = build_error(response)

        raise AuthenticationError, error_hash if code == 124
        raise BadRequest, error_hash if code == 400
        raise Unauthorized, error_hash if code == 401
        raise Forbidden, error_hash if code == 403
        raise NotFound, error_hash if code == 404
        raise Conflict, error_hash if code == 409
        raise TooManyRequests, error_hash if code == 429
        raise InternalServerError, error_hash if code == 500
        raise Error.new(error_hash, error_hash)
end

Which should properly map code 404 to NotFound right?

But, the http_response is returning a hash with the following content:

{"code"=>3001, "message"=>"Meeting is not found or has expired."}

And this weird code 3001 is the code mapped in the method raise_if_error! above.
I checked and the http_response actually is 404.

So, I guess Zoom has internally different code for different issues, but the regular HTTP status code remains as expected (404 for non existing resources)

Perhaps this mapping of code and Error should be using http_code and not response['code']?

Thanks!

@nm
Copy link

nm commented May 11, 2024

I stumbled across the issue as well and created a PR to address it: #473

@kyleboe
Copy link
Owner

kyleboe commented May 23, 2024

Resolved in #473

@kyleboe kyleboe closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants