shiftcommerce / flex-ruby-gem

💎 The Ruby library used to integrate with the Shift Platform API
MIT License
2 stars 0 forks source link

Improve server error handling #153

Closed hubertpompecki closed 6 years ago

hubertpompecki commented 6 years ago

When the back-end responds with a 500 error and the body of the following format:

{"message": "Internal server error"}

the gem is unable to form a proper error message and throws NoMethodError: undefined method 'first' for nil:NilClass. This makes debugging of the actual back-end response more difficult, see https://sentry.io/shift-commerce/matalan/issues/552886095/events/23884250449/ for an example.

This PR updates the gem so that it is able to correctly process responses like the one above and adds some tests coverage around this area.