Exception: PgVerify::Interpret::InterpretError
- Inherits:
-
Core::Error
- Object
- StandardError
- Core::Error
- PgVerify::Interpret::InterpretError
- Defined in:
- lib/pg-verify/interpret/interpret.rb
Instance Attribute Summary collapse
-
#cause ⇒ Object
Returns the value of attribute cause.
-
#line_number ⇒ Object
Returns the value of attribute line_number.
-
#script_file ⇒ Object
Returns the value of attribute script_file.
Instance Method Summary collapse
- #format_cause ⇒ Object
- #formatted ⇒ Object
-
#initialize(script_file, line_number, cause) ⇒ InterpretError
constructor
A new instance of InterpretError.
Methods inherited from Core::Error
Constructor Details
#initialize(script_file, line_number, cause) ⇒ InterpretError
Returns a new instance of InterpretError.
13 14 15 |
# File 'lib/pg-verify/interpret/interpret.rb', line 13 def initialize(script_file, line_number, cause) @script_file, @line_number, @cause = script_file, line_number, cause end |
Instance Attribute Details
#cause ⇒ Object
Returns the value of attribute cause.
11 12 13 |
# File 'lib/pg-verify/interpret/interpret.rb', line 11 def cause @cause end |
#line_number ⇒ Object
Returns the value of attribute line_number.
10 11 12 |
# File 'lib/pg-verify/interpret/interpret.rb', line 10 def line_number @line_number end |
#script_file ⇒ Object
Returns the value of attribute script_file.
9 10 11 |
# File 'lib/pg-verify/interpret/interpret.rb', line 9 def script_file @script_file end |
Instance Method Details
#format_cause ⇒ Object
28 29 30 31 |
# File 'lib/pg-verify/interpret/interpret.rb', line 28 def format_cause() return "#{cause}" unless cause.is_a?(Core::Error) return cause.to_formatted() end |
#formatted ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pg-verify/interpret/interpret.rb', line 17 def formatted() title = "Error while interpreting script at #{@script_file}:#{@line_number}" cause_str = format_cause() sloc = Model::SourceLocation.new(@script_file, @line_number) code_block = sloc.render_code_block body = "#{code_block}\n\n#{cause_str}" return title, body end |