diff options
author | Luke Kanies <luke@madstop.com> | 2009-10-23 15:49:48 -0700 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-12-09 02:13:02 +1100 |
commit | 39d4a935d47f1d42241ce492c48818dc5b533c29 (patch) | |
tree | defe4900a3f1b6ee76d3252a83e23a33c609b735 /lib/puppet | |
parent | 22c642df7e705792373c605422d368236e6f5a94 (diff) | |
download | puppet-39d4a935d47f1d42241ce492c48818dc5b533c29.tar.gz puppet-39d4a935d47f1d42241ce492c48818dc5b533c29.tar.xz puppet-39d4a935d47f1d42241ce492c48818dc5b533c29.zip |
Adding a context method to the Errors module
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/util/errors.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/puppet/util/errors.rb b/lib/puppet/util/errors.rb index badba595c..0d2f2da9f 100644 --- a/lib/puppet/util/errors.rb +++ b/lib/puppet/util/errors.rb @@ -17,6 +17,18 @@ module Puppet::Util::Errors return error end + def error_context + if file and line + " at #{file}:#{line}" + elsif line + " at line #{line}" + elsif file + " in #{file}" + else + "" + end + end + # Wrap a call in such a way that we always throw the right exception and keep # as much context as possible. def exceptwrap(options = {}) |