Exception: ComplexConfig::ComplexConfigError Abstract

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

Overview

This class is abstract.

Abstract base class for ComplexConfig exceptions

This class serves as the root of the exception hierarchy for the ComplexConfig library. All custom exceptions raised by ComplexConfig should inherit from this class.

Class Method Summary collapse

Class Method Details

.wrap(klass, e) ⇒ ComplexConfig::ComplexConfigError

Wraps an exception with a custom error class from the ComplexConfig hierarchy

This method takes an exception and wraps it with a new error class that is derived from the ComplexConfig error hierarchy. It allows for more specific error handling by converting one type of exception into another while preserving the original message and backtrace.

Parameters:

  • klass (Class, String)

    The error class to wrap the exception with, either as a Class object or a string name that can be resolved via ComplexConfig.const_get

  • e (StandardError)

    The original exception to be wrapped

Returns:



25
26
27
28
29
30
# File 'lib/complex_config/errors.rb', line 25

def self.wrap(klass, e)
  Class === klass or klass = ComplexConfig.const_get(klass)
  error = klass.new(e.message)
  error.set_backtrace(e.backtrace)
  error
end