Sha256: 88988571022f6f89d7e94ba329a5903e44fa9364ea7e37ba70a164fb0d0ebb80

Contents?: true

Size: 509 Bytes

Versions: 9

Compression:

Stored size: 509 Bytes

Contents

module Scrivito

  class ClientError < StandardError
    attr_reader :http_code, :backend_code

    def initialize(message, http_code, backend_code = nil)
      @http_code = http_code
      @backend_code = backend_code
      super(message)
    end

    def ==(client_error)
      message == client_error.message &&
        http_code == client_error.http_code &&
        backend_code == client_error.backend_code
    end

    def as_json
      {message: message, backend_code: backend_code}
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
scrivito_sdk-1.2.0 lib/scrivito/client_error.rb
scrivito_sdk-1.2.0.rc3 lib/scrivito/client_error.rb
scrivito_sdk-1.2.0.rc2 lib/scrivito/client_error.rb
scrivito_sdk-1.2.0.rc1 lib/scrivito/client_error.rb
scrivito_sdk-1.1.1 lib/scrivito/client_error.rb
scrivito_sdk-1.1.0 lib/scrivito/client_error.rb
scrivito_sdk-1.1.0.rc3 lib/scrivito/client_error.rb
scrivito_sdk-1.1.0.rc2 lib/scrivito/client_error.rb
scrivito_sdk-1.1.0.rc1 lib/scrivito/client_error.rb