Exception: Bolt::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Bolt::Error
- Defined in:
- lib/bolt/error.rb
Direct Known Subclasses
ApplyError, ApplyInventory::InvalidFunctionCall, CLIError, FileError, InvalidPlanResult, Inventory::Inventory2::WildcardError, Inventory::ValidationError, Inventory::WildcardError, NoImplementationError, Node::BaseError, PAL::PALError, PAL::YamlPlan::Transpiler::ConvertError, ParseError, PlanFailure, Plugin::PluginError, Plugin::Puppetdb::FactLookupError, PuppetDBError, PuppetError, PuppetfileError, RunFailure, UnknownTransportError, ValidationError, BoltServer::FileCache::Error
Instance Attribute Summary collapse
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#issue_code ⇒ Object
readonly
Returns the value of attribute issue_code.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(msg, kind, details = nil, issue_code = nil) ⇒ Error
constructor
A new instance of Error.
- #msg ⇒ Object
- #to_h ⇒ Object
- #to_json(opts = nil) ⇒ Object
- #to_puppet_error ⇒ Object
Constructor Details
#initialize(msg, kind, details = nil, issue_code = nil) ⇒ Error
Returns a new instance of Error.
7 8 9 10 11 12 13 |
# File 'lib/bolt/error.rb', line 7 def initialize(msg, kind, details = nil, issue_code = nil) super(msg) @kind = kind @issue_code = issue_code @details = details || {} @error_code ||= 1 end |
Instance Attribute Details
#details ⇒ Object (readonly)
Returns the value of attribute details.
5 6 7 |
# File 'lib/bolt/error.rb', line 5 def details @details end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
5 6 7 |
# File 'lib/bolt/error.rb', line 5 def error_code @error_code end |
#issue_code ⇒ Object (readonly)
Returns the value of attribute issue_code.
5 6 7 |
# File 'lib/bolt/error.rb', line 5 def issue_code @issue_code end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
5 6 7 |
# File 'lib/bolt/error.rb', line 5 def kind @kind end |
Class Method Details
.unknown_plan(plan) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/bolt/error.rb', line 40 def self.unknown_plan(plan) new( "Could not find a plan named \"#{plan}\". For a list of available plans, run \"bolt plan show\"", 'bolt/unknown-plan' ) end |
.unknown_task(task) ⇒ Object
35 36 37 38 |
# File 'lib/bolt/error.rb', line 35 def self.unknown_task(task) new("Could not find a task named \"#{task}\". For a list of available tasks, run \"bolt task show\"", 'bolt/unknown-task') end |
Instance Method Details
#msg ⇒ Object
15 16 17 |
# File 'lib/bolt/error.rb', line 15 def msg end |
#to_h ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/bolt/error.rb', line 19 def to_h h = { 'kind' => kind, 'msg' => , 'details' => details } h['issue_code'] = issue_code if issue_code h end |
#to_json(opts = nil) ⇒ Object
27 28 29 |
# File 'lib/bolt/error.rb', line 27 def to_json(opts = nil) to_h.to_json(opts) end |
#to_puppet_error ⇒ Object
31 32 33 |
# File 'lib/bolt/error.rb', line 31 def to_puppet_error Puppet::DataTypes::Error.from_asserted_hash(to_h) end |