Exception: Templator::ParseError
- Inherits:
-
Exception
- Object
- Exception
- Templator::ParseError
- Defined in:
- lib/templator/parameter_dsl.rb
Overview
Error wrapper of all errors occuring during the parsing of a parameter file. This wrapper provides convenient methods to retrieve the origin of the error.
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
Instance Method Summary collapse
-
#initialize(original_exception, file) ⇒ ParseError
constructor
A new instance of ParseError.
- #message_to_s ⇒ Object
- #origin_to_s ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(original_exception, file) ⇒ ParseError
Returns a new instance of ParseError.
56 57 58 59 60 61 |
# File 'lib/templator/parameter_dsl.rb', line 56 def initialize(original_exception, file) @original_exception = original_exception @file = file process original_exception end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
54 55 56 |
# File 'lib/templator/parameter_dsl.rb', line 54 def file @file end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
54 55 56 |
# File 'lib/templator/parameter_dsl.rb', line 54 def line @line end |
Instance Method Details
#message_to_s ⇒ Object
64 65 66 |
# File 'lib/templator/parameter_dsl.rb', line 64 def @message.sub(/\A.*:\d+:\s*/, "") end |
#origin_to_s ⇒ Object
68 69 70 |
# File 'lib/templator/parameter_dsl.rb', line 68 def origin_to_s "in file #{file}" + (@line ? " line #{@line}" : "") end |
#to_s ⇒ Object
73 74 75 |
# File 'lib/templator/parameter_dsl.rb', line 73 def to_s "ParseError #{origin_to_s}: #{}" end |