Exception: Typed::NoPayloadOnFailureError

Inherits:
StandardError
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/typed/no_payload_on_failure_error.rb

Overview

Error when user attempts to access payload from a Failure Result.

Instance Method Summary collapse

Constructor Details

#initialize(failure) ⇒ NoPayloadOnFailureError

Returns a new instance of NoPayloadOnFailureError.



10
11
12
13
14
15
16
17
# File 'lib/typed/no_payload_on_failure_error.rb', line 10

def initialize(failure)
  super(
    "Attempted to access `payload` from a Failure Result. " \
    "You were probably expecting a Success Result. " \
    "Check the result with `#success?` or `#failure?` before attempting to access `payload`. " \
    "Error encountered: #{failure.error.inspect}"
  )
end