Exception: Castkit::Error

Inherits:
StandardError
  • Object
show all
Includes:
Cattri
Defined in:
lib/castkit/error.rb

Overview

Base error class for all Castkit-related exceptions.

Instance Method Summary collapse

Constructor Details

#initialize(msg, context: nil) ⇒ Error

Initializes a Castkit error.

Parameters:

  • msg (String)

    the error message

  • context (Object, String, nil) (defaults to: nil)

    optional data object or hash for context



15
16
17
18
19
# File 'lib/castkit/error.rb', line 15

def initialize(msg, context: nil)
  super(msg)

  cattri_variable_set(:context, context, final: true)
end

Instance Method Details

#contextHash, ...

Returns contextual data to aid in debugging.

Returns:

  • (Hash, Object, nil)

    contextual data to aid in debugging



9
# File 'lib/castkit/error.rb', line 9

cattri :context, nil, expose: :read