Skip to content

Comments

API Error Parsing#53

Open
volleio wants to merge 2 commits intomapbox:masterfrom
mapdwell:fix/api-error-parsing
Open

API Error Parsing#53
volleio wants to merge 2 commits intomapbox:masterfrom
mapdwell:fix/api-error-parsing

Conversation

@volleio
Copy link

@volleio volleio commented Jan 22, 2021

This is a fix for #42 Error Granularity. Exceptions raised by the API will be returned with the correct message provided by the Mapbox API, such as:
API Error: 422 Unprocessable Entity - Query too long - 273/256 characters

fix: correct api error message parsing
fix: raise exceptions with formatted string

@samfader
Copy link
Contributor

samfader commented Feb 2, 2021

@volleio This looks good. Do you have any examples of queries that this helps? i.e. a sample query that fails and that your code gives some more context to?

@danielmorrison
Copy link

I can provide one. Here's the error I get from the gem:

StandardError: Invalid response object from API: <RestClient::Response 403 "{\"message\":..."> (HTTP response code was 403 Forbidden)

After this, I get the full message with an actionable step:

/Users/daniel/.rvm/gems/ruby-3.1.2/bundler/gems/mapbox-sdk-rb-46479c8ca614/lib/mapbox.rb:120:in `handle_api_error': API Error: 403 Forbidden - Permanent geocodes are not enabled for this account. Contact sales@mapbox.com to enable this feature. (StandardError)

@danielmorrison
Copy link

I hit this again today on another app. Fortunately I remembered my comment above, so I know to go request access to the Permanent Geocode API.

Would love to see this get merged.

@samfader
Copy link
Contributor

samfader commented Nov 8, 2023

Hi, unfortunately I'm not sure anyone maintains this library at this point @danielmorrison. Are you open to reviewing and merging? I can give you access to publishing the gem on RubyGems as well if desired.

@danielmorrison
Copy link

@samfader shoot but yeah I'd be open to that. I'm danielmorrison on RubyGems.

@samfader
Copy link
Contributor

samfader commented Nov 9, 2023

@danielmorrison Added! Let me know if that works.

@danielmorrison
Copy link

@samfader RubyGems works. Can you give me write access here too?

@samfader
Copy link
Contributor

Ah unfortunately I don't have write access and honestly not sure who does anymore :( Are you in contact with anyone at Mapbox? Might be worth reaching out to them.

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

Successfully merging this pull request may close these issues.

3 participants