Exception: Ruby::Rego::TypeError
- Defined in:
- lib/ruby/rego/errors.rb
Overview
Error raised for type-checking issues.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#actual ⇒ Object?
readonly
-
#context ⇒ String?
readonly
-
#expected ⇒ Object?
readonly
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(message, expected: nil, actual: nil, context: nil, location: nil) ⇒ TypeError
constructor
Create a type error.
Methods inherited from Error
Constructor Details
#initialize(message, expected: nil, actual: nil, context: nil, location: nil) ⇒ TypeError
Create a type error.
155 156 157 158 159 160 161 162 |
# File 'lib/ruby/rego/errors.rb', line 155 def initialize(, expected: nil, actual: nil, context: nil, location: nil) @expected = expected @actual = actual @context = context details = ErrorFormatting.format_details(expected: expected, actual: actual, context: context) composed = details.empty? ? : "#{} (#{details})" super(composed, location: location) end |
Instance Attribute Details
#actual ⇒ Object? (readonly)
143 144 145 |
# File 'lib/ruby/rego/errors.rb', line 143 def actual @actual end |
#context ⇒ String? (readonly)
146 147 148 |
# File 'lib/ruby/rego/errors.rb', line 146 def context @context end |
#expected ⇒ Object? (readonly)
140 141 142 |
# File 'lib/ruby/rego/errors.rb', line 140 def expected @expected end |