lib/uploadcare/concern/error_handler.rb
# Extension of ApiStruct's failure method
#
# Raises errors instead of returning falsey objects
# @see https://github.com/rubygarage/api_struct/blob/master/lib/api_struct/client.rb#L55
Extension of ApiStruct's failure method
Raises errors instead of returning falsey objects
Extension of ApiStruct ' s failure method Raises errors instead of returning falsey objects
def failure(response)
        catch_upload_errors(response)
        parsed_response = JSON.parse(response.body.to_s)
        raise RequestError, parsed_response['detail'] || parsed_response.map { |k, v| "#{k}: #{v}" }.join('; ')
      rescue JSON::ParserError
        raise RequestError, response.body.to_s
      end
def failure ( response ) catch_upload_errors ( response ) parsed_response = JSON . parse ( response . body . to_s ) raise RequestError , parsed_response [ 'detail' ] || parsed_response . map { | k , v | "#{k}: #{v}" } . join ( '; ' ) rescue JSON :: ParserError raise RequestError , response . body . to_s end
Extension of ApiStruct's failure method
Raises errors instead of returning falsey objects
Extension of ApiStruct ' s failure method Raises errors instead of returning falsey objects
response
see
None