Exception: Puppet::ParseErrorWithIssue
- Inherits:
-
ParseError
- Object
- RuntimeError
- Error
- ParseError
- Puppet::ParseErrorWithIssue
- Defined in:
- lib/puppet/error.rb
Overview
Contains an issue code and can be annotated with an environment and a node
Direct Known Subclasses
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#basic_message ⇒ Object
readonly
Returns the value of attribute basic_message.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#issue_code ⇒ Object
readonly
Returns the value of attribute issue_code.
-
#node ⇒ Object
Returns the value of attribute node.
Attributes included from ExternalFileError
#file, #line, #pos, #puppetstack
Attributes inherited from Error
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message, file = nil, line = nil, pos = nil, original = nil, issue_code = nil, arguments = nil) ⇒ ParseErrorWithIssue
constructor
A new instance of ParseErrorWithIssue.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(message, file = nil, line = nil, pos = nil, original = nil, issue_code = nil, arguments = nil) ⇒ ParseErrorWithIssue
Returns a new instance of ParseErrorWithIssue.
71 72 73 74 75 76 |
# File 'lib/puppet/error.rb', line 71 def initialize(, file = nil, line = nil, pos = nil, original = nil, issue_code = nil, arguments = nil) super(, file, line, pos, original) @issue_code = issue_code @basic_message = @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
60 61 62 |
# File 'lib/puppet/error.rb', line 60 def arguments @arguments end |
#basic_message ⇒ Object (readonly)
Returns the value of attribute basic_message.
60 61 62 |
# File 'lib/puppet/error.rb', line 60 def @basic_message end |
#environment ⇒ Object
Returns the value of attribute environment.
61 62 63 |
# File 'lib/puppet/error.rb', line 61 def environment @environment end |
#issue_code ⇒ Object (readonly)
Returns the value of attribute issue_code.
60 61 62 |
# File 'lib/puppet/error.rb', line 60 def issue_code @issue_code end |
#node ⇒ Object
Returns the value of attribute node.
61 62 63 |
# File 'lib/puppet/error.rb', line 61 def node @node end |
Class Method Details
.from_issue_and_stack(issue, args = {}) ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/puppet/error.rb', line 98 def self.from_issue_and_stack(issue, args = {}) filename, line = Puppet::Pops::PuppetStack.top_of_stack new( issue.format(args), filename, line, nil, nil, issue.issue_code, args ) end |
Instance Method Details
#to_h ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/puppet/error.rb', line 85 def to_h { :issue_code => issue_code, :message => , :full_message => to_s, :file => file, :line => line, :pos => pos, :environment => environment.to_s, :node => node.to_s, } end |
#to_s ⇒ Object
78 79 80 81 82 83 |
# File 'lib/puppet/error.rb', line 78 def to_s msg = super msg = _("Could not parse for environment %{environment}: %{message}") % { environment: environment, message: msg } if environment msg = _("%{message} on node %{node}") % { message: msg, node: node } if node msg end |