Module: Puppet::ExternalFileError
- Included in:
- DevError, ErrorWithData, ParseError, Parser::Compiler::CatalogValidationError, Resource::Catalog::DuplicateResourceError, ResourceError, Settings::ParseError, Util::IniConfig::IniParseError
- Defined in:
- lib/puppet/error.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
This module implements logging with a filename and line number.
-
#line ⇒ Object
This module implements logging with a filename and line number.
-
#pos ⇒ Object
This module implements logging with a filename and line number.
-
#puppetstack ⇒ Object
This module implements logging with a filename and line number.
Instance Method Summary collapse
-
#initialize(message, file = nil, line = nil, pos = nil, original = nil) ⇒ Object
May be called with 3 arguments for message, file, line, and exception, or 4 args including the position on the line.
- #to_s ⇒ Object
Instance Attribute Details
#file ⇒ Object
This module implements logging with a filename and line number. Use this for errors that need to report a location in a non-ruby file that we parse.
18 19 20 |
# File 'lib/puppet/error.rb', line 18 def file @file end |
#line ⇒ Object
This module implements logging with a filename and line number. Use this for errors that need to report a location in a non-ruby file that we parse.
18 19 20 |
# File 'lib/puppet/error.rb', line 18 def line @line end |
#pos ⇒ Object
This module implements logging with a filename and line number. Use this for errors that need to report a location in a non-ruby file that we parse.
18 19 20 |
# File 'lib/puppet/error.rb', line 18 def pos @pos end |
#puppetstack ⇒ Object
This module implements logging with a filename and line number. Use this for errors that need to report a location in a non-ruby file that we parse.
18 19 20 |
# File 'lib/puppet/error.rb', line 18 def puppetstack @puppetstack end |
Instance Method Details
#initialize(message, file = nil, line = nil, pos = nil, original = nil) ⇒ Object
May be called with 3 arguments for message, file, line, and exception, or 4 args including the position on the line.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/puppet/error.rb', line 23 def initialize(, file = nil, line = nil, pos = nil, original = nil) if pos.is_a? Exception original = pos pos = nil end super(, original) @file = file unless file.is_a?(String) && file.empty? @line = line @pos = pos if original && original.respond_to?(:puppetstack) @puppetstack = original.puppetstack else @puppetstack = Puppet::Pops::PuppetStack.stacktrace() end end |
#to_s ⇒ Object
42 43 44 45 46 47 |
# File 'lib/puppet/error.rb', line 42 def to_s msg = super @file = nil if @file.is_a?(String) && @file.empty? msg += Puppet::Util::Errors.error_location_with_space(@file, @line, @pos) msg end |