Sha256: 6be274b0447a88b957bada8228c46ecc3b53104b545b7e58ebe1d662bf1053de

Contents?: true

Size: 512 Bytes

Versions: 12

Compression:

Stored size: 512 Bytes

Contents

module Scrivito

  class ClientError < StandardError
    attr_reader :http_code, :backend_code

    def initialize(message, http_code: 412, 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, backendCode: backend_code}
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
scrivito_sdk-1.9.1 lib/scrivito/client_error.rb
scrivito_sdk-1.9.1.rc1 lib/scrivito/client_error.rb
scrivito_sdk-1.9.0 lib/scrivito/client_error.rb
scrivito_sdk-1.9.0.rc2 lib/scrivito/client_error.rb
scrivito_sdk-1.9.0.rc1 lib/scrivito/client_error.rb
scrivito_sdk-1.8.1 lib/scrivito/client_error.rb
scrivito_sdk-1.8.1.rc1 lib/scrivito/client_error.rb
scrivito_sdk-1.8.0 lib/scrivito/client_error.rb
scrivito_sdk-1.8.0.rc2 lib/scrivito/client_error.rb
scrivito_sdk-1.8.0.rc1 lib/scrivito/client_error.rb
scrivito_sdk-1.7.0 lib/scrivito/client_error.rb
scrivito_sdk-1.7.0.rc2 lib/scrivito/client_error.rb