Class: Cuprum::Errors::UncaughtException

Inherits:
Cuprum::Error show all
Defined in:
lib/cuprum/errors/uncaught_exception.rb

Overview

Error returned when a command encounters an unhandled exception.

Constant Summary collapse

TYPE =

Short string used to identify the type of error.

'cuprum.collections.errors.uncaught_exception'

Instance Attribute Summary collapse

Attributes inherited from Cuprum::Error

#message, #type

Instance Method Summary collapse

Methods inherited from Cuprum::Error

#==, #as_json

Constructor Details

#initialize(exception:, message: 'uncaught exception') ⇒ UncaughtException

Returns a new instance of UncaughtException.

Parameters:

  • exception (StandardError)

    The exception that was raised.

  • message (String) (defaults to: 'uncaught exception')

    A message to display. Will be annotated with details on the exception and the exception’s cause (if any).



15
16
17
18
19
20
# File 'lib/cuprum/errors/uncaught_exception.rb', line 15

def initialize(exception:, message: 'uncaught exception')
  @exception = exception
  @cause     = exception.cause

  super(message: generate_message(message))
end

Instance Attribute Details

#exceptionStandardError (readonly)

Returns the exception that was raised.

Returns:

  • (StandardError)

    the exception that was raised.



23
24
25
# File 'lib/cuprum/errors/uncaught_exception.rb', line 23

def exception
  @exception
end