-
Notifications
You must be signed in to change notification settings - Fork 30
Description
I am trying to use this gem as a replacement to Geocoder. In my application, if we have trouble communicating with Mapbox when making a request, we rescue that error and perform some fallback behavior.
Unfortunately, any error other than the AuthenticationError that is returned in this gem is a StandardError. So I am left to rescue StandardError which will rescue much more than any error communicating with Mapbox, most of which I would want it to not rescue.
Here you'll see a class called MapboxError, which inherits from StandardError. Can we replace all the instances of StandardError with MapboxError in this file? Then there will at least a catch-all for errors that are related to this SDK.
Eventually I'd hope we could get even more granular and have mapbox-sdk specific errors for every scenario, like they did in the Stripe SDK https://github.com/stripe/stripe-ruby/blob/master/lib/stripe/errors.rb. However, that can come later because for the majority of cases I would assume the difference between rescuing all mapbox-sdk errors and rescuing specific mapbox-sdk errors is a lot smaller than the difference between rescuing all mapbox-sdk errors and rescuing all errors that inherit from StandardError 😅
Please let me know how you want to proceed on this, I would love to hear about Mapbox's process for handling issues in their open-source SDKs.