Exception: Puppet::Error
- Defined in:
- lib/vendor/puppet/error.rb
Overview
The base class for all Puppet errors. We want to make it easy to add line and file information. This probably isn’t necessary for all errors, but…
Direct Known Subclasses
AuthStoreError, AuthorizationError, ConfigurationError, ConstantAlreadyDefined, DevError, ExecutionFailure, Module::Error, Network::AuthorizationError, Network::FormatHandler::FormatError, Network::Handler::FileServerError, Network::Handler::MasterError, Network::InvalidClientRequest, NoSuchFile, ParseError, Resource::Catalog::DuplicateResourceError, SubclassAlreadyDefined, Util::Windows::Error
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#line ⇒ Object
Returns the value of attribute line.
Instance Method Summary collapse
- #backtrace ⇒ Object
-
#initialize(message, line = nil, file = nil) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(message, line = nil, file = nil) ⇒ Error
Returns a new instance of Error.
16 17 18 19 20 21 |
# File 'lib/vendor/puppet/error.rb', line 16 def initialize(, line = nil, file = nil) @message = @line = line if line @file = file if file end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
6 7 8 |
# File 'lib/vendor/puppet/error.rb', line 6 def file @file end |
#line ⇒ Object
Returns the value of attribute line.
6 7 8 |
# File 'lib/vendor/puppet/error.rb', line 6 def line @line end |
Instance Method Details
#backtrace ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/vendor/puppet/error.rb', line 8 def backtrace if defined?(@backtrace) return @backtrace else return super end end |
#to_s ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vendor/puppet/error.rb', line 23 def to_s str = nil if self.file and self.line str = "#{@message} at #{@file}:#{@line}" elsif self.line str = "#{@message} at line #{@line}" elsif self.file str = "#{@message} in #{self.file}" else str = @message.to_s end str end |