Sha256: 04557d13743bf41db2c2ed6bae1b0ff1003fda86b718bf6a644b2936dec5407d

Contents?: true

Size: 626 Bytes

Versions: 47

Compression:

Stored size: 626 Bytes

Contents

module ZendeskAPI
  module Error
    class ClientError < Faraday::Error::ClientError
      attr_reader :wrapped_exception
    end

    class RecordInvalid < ClientError
      attr_accessor :response, :errors

      def initialize(response)
        @response = response

        if response[:body].is_a?(Hash) && response[:body].key?("details")
          @errors = response[:body]["details"]
        else
          @errors = {}
        end
      end

      def to_s
        "#{self.class.name}: #{@errors.to_s}"
      end
    end

    class NetworkError < ClientError; end
    class RecordNotFound < ClientError; end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
zendesk_api-1.11.0 lib/zendesk_api/error.rb
zendesk_api-1.10.0 lib/zendesk_api/error.rb
zendesk_api-1.9.6 lib/zendesk_api/error.rb
zendesk_api-1.9.5 lib/zendesk_api/error.rb
zendesk_api-1.9.4 lib/zendesk_api/error.rb
zendesk_api-1.9.3 lib/zendesk_api/error.rb
zendesk_api-1.9.2 lib/zendesk_api/error.rb
zendesk_api-1.9.1 lib/zendesk_api/error.rb
zendesk_api-1.9.0 lib/zendesk_api/error.rb
zendesk_api-1.8.0 lib/zendesk_api/error.rb
zendesk_api-1.7.4 lib/zendesk_api/error.rb
zendesk_api-1.7.3 lib/zendesk_api/error.rb
zendesk_api-1.7.1 lib/zendesk_api/error.rb
zendesk_api-1.7.0 lib/zendesk_api/error.rb
zendesk_api-1.6.3 lib/zendesk_api/error.rb
zendesk_api-1.6.2 lib/zendesk_api/error.rb
zendesk_api-1.6.1 lib/zendesk_api/error.rb
zendesk_api-1.6.0 lib/zendesk_api/error.rb
zendesk_api-1.5.1 lib/zendesk_api/error.rb
zendesk_api-1.5.0 lib/zendesk_api/error.rb