Exception: Edoxen::ValidationError
- Defined in:
- lib/edoxen/error.rb,
sig/edoxen.rbs
Overview
Unified validation failure shape. Produced by both:
* SchemaValidator — JSON-Schema violations and YAML syntax errors
carry source: :schema (or :syntax for Psych::SyntaxError).
* DecisionCollection.from_yaml rescues in the CLI — model parse
failures carry source: :model.
One type at the seam means callers (CLI, future renderers, tests) handle one shape instead of N.
Constant Summary collapse
- SOURCE_SCHEMA =
:schema- SOURCE_MODEL =
:model- SOURCE_SYNTAX =
:syntax
Instance Attribute Summary collapse
-
#column ⇒ Integer
readonly
Returns the value of attribute column.
-
#file ⇒ String
readonly
Returns the value of attribute file.
-
#line ⇒ Integer
readonly
Returns the value of attribute line.
-
#message_text ⇒ String
readonly
Returns the value of attribute message_text.
-
#pointer ⇒ String
readonly
Returns the value of attribute pointer.
-
#source ⇒ Symbol
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(file:, line:, column:, message_text:, pointer: "", source: SOURCE_SCHEMA) ⇒ ValidationError
constructor
A new instance of ValidationError.
- #to_clickable_format ⇒ String
Constructor Details
#initialize(file:, line:, column:, message_text:, pointer: "", source: SOURCE_SCHEMA) ⇒ ValidationError
Returns a new instance of ValidationError.
22 23 24 25 26 27 28 29 30 |
# File 'lib/edoxen/error.rb', line 22 def initialize(file:, line:, column:, message_text:, pointer: "", source: SOURCE_SCHEMA) @file = file @line = line @column = column @pointer = pointer.to_s @message_text = @source = source super(to_clickable_format) end |
Instance Attribute Details
#column ⇒ Integer (readonly)
Returns the value of attribute column.
20 21 22 |
# File 'lib/edoxen/error.rb', line 20 def column @column end |
#file ⇒ String (readonly)
Returns the value of attribute file.
20 21 22 |
# File 'lib/edoxen/error.rb', line 20 def file @file end |
#line ⇒ Integer (readonly)
Returns the value of attribute line.
20 21 22 |
# File 'lib/edoxen/error.rb', line 20 def line @line end |
#message_text ⇒ String (readonly)
Returns the value of attribute message_text.
20 21 22 |
# File 'lib/edoxen/error.rb', line 20 def @message_text end |
#pointer ⇒ String (readonly)
Returns the value of attribute pointer.
20 21 22 |
# File 'lib/edoxen/error.rb', line 20 def pointer @pointer end |
#source ⇒ Symbol (readonly)
Returns the value of attribute source.
20 21 22 |
# File 'lib/edoxen/error.rb', line 20 def source @source end |
Instance Method Details
#to_clickable_format ⇒ String
32 33 34 35 |
# File 'lib/edoxen/error.rb', line 32 def to_clickable_format suffix = @pointer.empty? ? "" : " at `#{@pointer}`" "#{@file}:#{@line}:#{@column}: #{@message_text}#{suffix}" end |