Exception: OpenReceive::Server::ServiceError

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

Overview

Generic service error carrying an explicit HTTP status + canonical code, the Ruby analogue of the JS ServiceError. Used where the JS service raises serviceError(status, code, message) — e.g. the swap flows — so both engines put the same status/code/message on the wire.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, code, message, retryable: nil, details: nil) ⇒ ServiceError

Returns a new instance of ServiceError.



15
16
17
18
19
20
21
# File 'lib/openreceive/server/errors.rb', line 15

def initialize(status, code, message, retryable: nil, details: nil)
  super(message)
  @status = status
  @code = code
  @retryable = retryable
  @details = details
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



13
14
15
# File 'lib/openreceive/server/errors.rb', line 13

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



13
14
15
# File 'lib/openreceive/server/errors.rb', line 13

def details
  @details
end

#retryableObject (readonly)

Returns the value of attribute retryable.



13
14
15
# File 'lib/openreceive/server/errors.rb', line 13

def retryable
  @retryable
end

#statusObject (readonly)

Returns the value of attribute status.



13
14
15
# File 'lib/openreceive/server/errors.rb', line 13

def status
  @status
end