Open volleio opened 3 years ago
@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?
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)
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.
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.
@samfader shoot but yeah I'd be open to that. I'm danielmorrison
on RubyGems.
@danielmorrison Added! Let me know if that works.
@samfader RubyGems works. Can you give me write access here too?
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.
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