Exception: R10K::Error

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

Overview

An error class that accepts an optional hash and wrapped error message

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mesg) ⇒ Error #initialize(mesg, options) ⇒ Error

Returns a new instance of Error.

Overloads:

  • #initialize(mesg) ⇒ Error

    Parameters:

    • mesg (String)

      The exception mesg

  • #initialize(mesg, options) ⇒ Error

    Parameters:

    • mesg (String)

      The exception mesg

    • options (Hash)

      A set of options to store on the exception



35
36
37
38
# File 'lib/r10k/errors.rb', line 35

def initialize(mesg, options = {})
  super(mesg)
  @options = options
end

Instance Attribute Details

#originalObject

Returns the value of attribute original.



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

def original
  @original
end

Class Method Details

.wrap(original, mesg, options = {}) ⇒ R10K::Error

Generate a wrapped exception

Parameters:

  • original (Exception)

    The exception to wrap

  • mesg (String)
  • options (Hash) (defaults to: {})

Returns:



22
23
24
25
26
27
# File 'lib/r10k/errors.rb', line 22

def self.wrap(original, mesg, options = {})
  new(mesg, options).tap do |e|
    e.set_backtrace(caller(4))
    e.original = original
  end
end