Exception: Ruby::Rego::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Ruby::Rego::Error
- Defined in:
- lib/ruby/rego/errors.rb
Overview
Base error for all Ruby::Rego exceptions.
Direct Known Subclasses
CompilationError, EvaluationError, LexerError, ObjectKeyConflictError, ParserError, TypeError, UnificationError
Instance Attribute Summary collapse
-
#location ⇒ Location?
readonly
Instance Method Summary collapse
-
#initialize(message = nil, location: nil) ⇒ Error
constructor
Create a new error with optional location details.
-
#to_h ⇒ Hash{Symbol => Object}
Serialize the error to a hash.
Constructor Details
#initialize(message = nil, location: nil) ⇒ Error
Create a new error with optional location details.
30 31 32 33 34 |
# File 'lib/ruby/rego/errors.rb', line 30 def initialize( = nil, location: nil) @raw_message = @location = location super(()) end |
Instance Attribute Details
#location ⇒ Location? (readonly)
24 25 26 |
# File 'lib/ruby/rego/errors.rb', line 24 def location @location end |
Instance Method Details
#to_h ⇒ Hash{Symbol => Object}
Serialize the error to a hash.
39 40 41 42 43 44 45 |
# File 'lib/ruby/rego/errors.rb', line 39 def to_h { message: , type: self.class.name, location: location&.to_s } end |