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

- old
+ new

@@ -42,11 +42,13 @@ private def extract_errors(response) payload = JSON.parse(response.body) errors = if payload['error'] [payload['error']] - else - payload['errors'].to_a.map { |error| error['detail'] } + elsif payload['errors'].is_a?(Array) + payload['errors'].map { |error| error['detail'] } + elsif payload['errors'].is_a?(Hash) + payload['errors'] end { errors: errors, status: 'error' } end