Class: Berkshelf::VagrantWrapperError

Inherits:
Vagrant::Errors::VagrantError
  • Object
show all
Defined in:
lib/berkshelf/vagrant/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

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(original) ⇒ VagrantWrapperError

Returns a new instance of VagrantWrapperError.

Parameters:

  • original (BerkshelfError)


19
20
21
# File 'lib/berkshelf/vagrant/errors.rb', line 19

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)



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

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

Instance Attribute Details

#originalObject (readonly)

Parameters:

  • (BerkshelfError)


16
17
18
# File 'lib/berkshelf/vagrant/errors.rb', line 16

def original
  @original
end

Instance Method Details

#to_sObject



23
24
25
# File 'lib/berkshelf/vagrant/errors.rb', line 23

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