Module Backup::Errors
In: lib/backup/errors.rb

provides cascading errors with formatted messages see the specs for details

e.g. module Backup

  begin
    begin
      begin
        raise Errors::ZoneAError, 'an error occurred in Zone A'
      rescue => err
        raise Errors::ZoneBError.wrap(err, <<-EOS)
          an error occurred in Zone B

          the following error should give a reason
        EOS
      end
    rescue => err
      raise Errors::ZoneCError.wrap(err)
    end
  rescue => err
    puts Errors::ZoneDError.wrap(err, 'an error occurred in Zone D')
  end

end

Outputs:

  ZoneDError: an error occurred in Zone D
    Reason: ZoneCError
    ZoneBError: an error occurred in Zone B

    the following error should give a reason
    Reason: ZoneAError
    an error occurred in Zone A

Classes and Modules

Class Backup::Errors::Error

[Validate]