lib/uploadcare/concern/error_handler.rb
# Upload API returns its errors with code 200, and stores its actual code and details within response message
# This methods detects that and raises apropriate error
Upload API returns its errors with code 200, and stores its actual code and details within response message
This methods detects that and raises apropriate error
Upload API returns its errors with code 200 and stores its actual code and details within response message This methods detects that and raises apropriate error
def catch_upload_errors(response)
        return unless response.code == 200
        parsed_response = JSON.parse(response.body.to_s)
        error = parsed_response['error'] if parsed_response.is_a?(Hash)
        raise RequestError, error if error
      end
def catch_upload_errors ( response ) return unless response . code == 200 parsed_response = JSON . parse ( response . body . to_s ) error = parsed_response [ 'error' ] if parsed_response . is_a? ( Hash ) raise RequestError , error if error end
Upload API returns its errors with code 200, and stores its actual code and details within response message
This methods detects that and raises apropriate error
Upload API returns its errors with code 200 and stores its actual code and details within response message This methods detects that and raises apropriate error
response