Sha256: e9425a0ed78612ad5cde0cdf66b1f15a47b9cb9fc4701371b20346f4c26055bb

Contents?: true

Size: 790 Bytes

Versions: 3

Compression:

Stored size: 790 Bytes

Contents

require 'vagrant/errors'

module Berkshelf
  # 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.
  #
  # @example wrapping an error encountered within the Vagrant plugin
  #   rescue BerkshelfError => e
  #     VagrantWrapperError.new(e)
  #   end
  class VagrantWrapperError < ::Vagrant::Errors::VagrantError
    # @param [BerkshelfError]
    attr_reader :original

    # @param [BerkshelfError] original
    def initialize(original)
      @original = original
    end

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

    private

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-berkshelf-2.0.1 lib/berkshelf/vagrant/errors.rb
vagrant-berkshelf-2.0.0.rc4 lib/berkshelf/vagrant/errors.rb
vagrant-berkshelf-2.0.0.rc3 lib/berkshelf/vagrant/errors.rb