Class: Berkshelf::VagrantWrapperError

Inherits:
Vagrant::Errors::VagrantError
  • Object
show all
Defined in:
lib/berkshelf/errors.rb

Overview

A wrapper for a BerkshelfError for Vagrant. All Berkshelf exceptions should be wrapped in this proxy object so they are properly handled when Vagrant encounters an exception.

Examples:

wrapping an error encountered within the Vagrant plugin

rescue BerkshelfError => e
  VagrantWrapperError.new(e)
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(original) ⇒ VagrantWrapperError

Returns a new instance of VagrantWrapperError.

Parameters:



29
30
31
# File 'lib/berkshelf/errors.rb', line 29

def initialize(original)
  @original = original
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(fun, *args, &block) ⇒ Object (private)



39
40
41
# File 'lib/berkshelf/errors.rb', line 39

def method_missing(fun, *args, &block)
  original.send(fun, *args, &block)
end

Instance Attribute Details

#originalObject (readonly)

Parameters:



26
27
28
# File 'lib/berkshelf/errors.rb', line 26

def original
  @original
end

Instance Method Details

#to_sObject



33
34
35
# File 'lib/berkshelf/errors.rb', line 33

def to_s
  "#{original.class}: #{original.to_s}"
end