Exception: Bolt::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Bolt::Error
show all
- Defined in:
- lib/bolt/error.rb
Direct Known Subclasses
ApplyError, ApplyInventory::InvalidFunctionCall, CLIError, FileError, InvalidPlanResult, Inventory::Inventory::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
Class Method Summary
collapse
Instance Method Summary
collapse
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
Returns the value of attribute details.
5
6
7
|
# File 'lib/bolt/error.rb', line 5
def details
@details
end
|
#error_code ⇒ Object
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
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
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
44
45
46
47
48
49
|
# File 'lib/bolt/error.rb', line 44
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
39
40
41
42
|
# File 'lib/bolt/error.rb', line 39
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
#add_filelineno(details) ⇒ Object
27
28
29
|
# File 'lib/bolt/error.rb', line 27
def add_filelineno(details)
@details.merge!(details) unless @details['file']
end
|
#msg ⇒ Object
15
16
17
|
# File 'lib/bolt/error.rb', line 15
def msg
message
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' => message,
'details' => details }
h['issue_code'] = issue_code if issue_code
h
end
|
#to_json(opts = nil) ⇒ Object
31
32
33
|
# File 'lib/bolt/error.rb', line 31
def to_json(opts = nil)
to_h.to_json(opts)
end
|
#to_puppet_error ⇒ Object
35
36
37
|
# File 'lib/bolt/error.rb', line 35
def to_puppet_error
Puppet::DataTypes::Error.from_asserted_hash(to_h)
end
|