Exception: LLIP::LLIPError
- Inherits:
-
StandardError
- Object
- StandardError
- LLIP::LLIPError
- Defined in:
- lib/llip/llip_error.rb
Overview
It’s the base Exception for all the exception of LLIP. It adds a header to all the messages with the line and the char of the token that caused the exception.
To subclass it for a class-specific message, pass it to the constructor or override the :message method.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
The token that caused the exception.
Instance Method Summary collapse
-
#initialize(token, msg = nil) ⇒ LLIPError
constructor
A new instance of LLIPError.
- #internal_message ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(token, msg = nil) ⇒ LLIPError
Returns a new instance of LLIPError.
16 17 18 19 |
# File 'lib/llip/llip_error.rb', line 16 def initialize(token,msg=nil) super msg @token = token end |
Instance Attribute Details
#token ⇒ Object (readonly)
The token that caused the exception
14 15 16 |
# File 'lib/llip/llip_error.rb', line 14 def token @token end |
Instance Method Details
#internal_message ⇒ Object
21 |
# File 'lib/llip/llip_error.rb', line 21 alias :internal_message :to_s |
#to_s ⇒ Object
23 24 25 |
# File 'lib/llip/llip_error.rb', line 23 def to_s "At line #{token.line} char #{token.char} a #{self.class.name} occurred: #{}" end |