Exception: Bolt::PAL::PALError
Overview
PALError is used to convert errors from executing puppet code into Bolt::Errors
Instance Attribute Summary
Attributes inherited from Error
#details, #error_code, #issue_code, #kind
Class Method Summary collapse
-
.from_error(err) ⇒ Object
Generate a Bolt::Pal::PALError for non-bolt errors.
- .from_preformatted_error(err) ⇒ Object
Instance Method Summary collapse
-
#initialize(msg, details = {}) ⇒ PALError
constructor
A new instance of PALError.
Methods inherited from Error
#msg, #to_h, #to_json, #to_puppet_error, unknown_plan, unknown_task
Constructor Details
#initialize(msg, details = {}) ⇒ PALError
Returns a new instance of PALError.
46 47 48 |
# File 'lib/bolt/pal.rb', line 46 def initialize(msg, details = {}) super(msg, 'bolt/pal-error', details) end |
Class Method Details
.from_error(err) ⇒ Object
Generate a Bolt::Pal::PALError for non-bolt errors
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/bolt/pal.rb', line 27 def self.from_error(err) # Use the original error message if available = err.cause ? err.cause. : err. # Provide the location of an error if it came from a plan details = if defined?(err.file) && err.file { file: err.file, line: err.line, column: err.pos }.compact else {} end e = new(, details) e.set_backtrace(err.backtrace) e end |