lib/pdfmonkey/adapter.rb in pdfmonkey-0.7.0 vs lib/pdfmonkey/adapter.rb in pdfmonkey-0.8.0

- old
+ new

@@ -39,10 +39,15 @@ JSON.parse(response.body).fetch(member) end private def extract_errors(response) payload = JSON.parse(response.body) - errors = payload['errors'].to_a.map { |error| error['detail'] } + errors = + if payload['error'] + [payload['error']] + else + payload['errors'].to_a.map { |error| error['detail'] } + end { errors: errors, status: 'error' } end private def headers