Exception: Synthra::Errors::ValidationError
- Inherits:
-
ParseError
- Object
- StandardError
- Error
- ParseError
- Synthra::Errors::ValidationError
- Defined in:
- lib/synthra/errors.rb
Overview
Base class for Simulyra DSL validation errors
ValidationError provides structured error messages with suggestions for how to fix the problem.
Direct Known Subclasses
ApiError, ContextError, ReferenceError, ScenarioError, SchemaError, TypeError
Constant Summary collapse
- ERROR_CODE =
"VALIDATION_ERROR"
Instance Attribute Summary collapse
-
#suggestion ⇒ String?
readonly
Suggestion for how to fix the error.
Instance Method Summary collapse
-
#initialize(message, line: nil, suggestion: nil, **kwargs) ⇒ ValidationError
constructor
Create a new ValidationError.
Constructor Details
#initialize(message, line: nil, suggestion: nil, **kwargs) ⇒ ValidationError
Create a new ValidationError
483 484 485 486 487 488 |
# File 'lib/synthra/errors.rb', line 483 def initialize(, line: nil, suggestion: nil, **kwargs) @suggestion = suggestion = += " -> #{suggestion}" if suggestion super(, line: line, **kwargs) end |
Instance Attribute Details
#suggestion ⇒ String? (readonly)
Returns suggestion for how to fix the error.
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
# File 'lib/synthra/errors.rb', line 473 class ValidationError < ParseError ERROR_CODE = "VALIDATION_ERROR" attr_reader :suggestion # Create a new ValidationError # # @param message [String] error description # @param line [Integer, nil] line number where error occurred # @param suggestion [String, nil] suggestion for fixing the error # def initialize(, line: nil, suggestion: nil, **kwargs) @suggestion = suggestion = += " -> #{suggestion}" if suggestion super(, line: line, **kwargs) end end |