Exception: Puppet::ParseErrorWithIssue

Inherits:
ParseError show all
Defined in:
lib/puppet/error.rb

Overview

Contains an issue code and can be annotated with an environment and a node

Direct Known Subclasses

PreformattedError

Instance Attribute Summary collapse

Attributes included from ExternalFileError

#file, #line, #pos

Attributes inherited from Error

#original

Instance Method Summary collapse

Constructor Details

#initialize(message, file = nil, line = nil, pos = nil, original = nil, issue_code = nil) ⇒ ParseErrorWithIssue

Returns a new instance of ParseErrorWithIssue.

Parameters:

  • message (String)

    The error message

  • file (String) (defaults to: nil)

    The path to the file where the error was found

  • line (Integer) (defaults to: nil)

    The line in the file

  • pos (Integer) (defaults to: nil)

    The position on the line

  • original (Exception) (defaults to: nil)

    Original exception

  • issue_code (Symbol) (defaults to: nil)

    The issue code



69
70
71
72
73
# File 'lib/puppet/error.rb', line 69

def initialize(message, file=nil, line=nil, pos=nil, original=nil, issue_code= nil)
  super(message, file, line, pos, original)
  @issue_code = issue_code
  @basic_message = message
end

Instance Attribute Details

#basic_messageObject (readonly)

Returns the value of attribute basic_message.



59
60
61
# File 'lib/puppet/error.rb', line 59

def basic_message
  @basic_message
end

#environmentObject

Returns the value of attribute environment.



60
61
62
# File 'lib/puppet/error.rb', line 60

def environment
  @environment
end

#issue_codeObject (readonly)

Returns the value of attribute issue_code.



59
60
61
# File 'lib/puppet/error.rb', line 59

def issue_code
  @issue_code
end

#nodeObject

Returns the value of attribute node.



60
61
62
# File 'lib/puppet/error.rb', line 60

def node
  @node
end

Instance Method Details

#to_sObject



75
76
77
78
79
80
# File 'lib/puppet/error.rb', line 75

def to_s
  msg = super
  msg = "Could not parse for environment #{environment}: #{msg}" if environment
  msg = "#{msg} on node #{node}" if node
  msg
end