Exception: OpenReceive::Server::WalletFailureError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/openreceive/server/errors.rb

Overview

Wallet/relay failure normalized per the shared error-normalization vectors. Carries the canonical code and retryable flag so browsers can distinguish "retry" from "bug" against Rails exactly as against Node.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(normalized) ⇒ WalletFailureError

Returns a new instance of WalletFailureError.



171
172
173
174
175
176
177
# File 'lib/openreceive/server/errors.rb', line 171

def initialize(normalized)
  super(normalized.fetch("message"))
  @code = normalized.fetch("code")
  @retryable = normalized.fetch("retryable", false)
  @details = normalized["details"]
  @status = @retryable ? 503 : 502
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



169
170
171
# File 'lib/openreceive/server/errors.rb', line 169

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



169
170
171
# File 'lib/openreceive/server/errors.rb', line 169

def details
  @details
end

#retryableObject (readonly)

Returns the value of attribute retryable.



169
170
171
# File 'lib/openreceive/server/errors.rb', line 169

def retryable
  @retryable
end

#statusObject (readonly)

Returns the value of attribute status.



169
170
171
# File 'lib/openreceive/server/errors.rb', line 169

def status
  @status
end