Exception: Canon::ValidationError

Inherits:
Error
  • Object
show all
Defined in:
lib/canon/errors.rb

Overview

Error raised when input validation fails

This error is raised when input (XML, HTML, JSON, YAML) is malformed or fails validation checks. It includes detailed information about the error location and nature.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, format:, line: nil, column: nil, details: nil) ⇒ ValidationError

Initialize a new ValidationError

Parameters:

  • message (String)

    The error message

  • format (Symbol)

    The format being validated (:xml, :html, :json, :yaml)

  • line (Integer, nil) (defaults to: nil)

    The line number where the error occurred

  • column (Integer, nil) (defaults to: nil)

    The column number where the error occurred

  • details (String, nil) (defaults to: nil)

    Additional details about the error



34
35
36
37
38
39
40
# File 'lib/canon/errors.rb', line 34

def initialize(message, format:, line: nil, column: nil, details: nil)
  @format = format
  @line = line
  @column = column
  @details = details
  super(build_message(message))
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



24
25
26
# File 'lib/canon/errors.rb', line 24

def column
  @column
end

#detailsObject (readonly)

Returns the value of attribute details.



24
25
26
# File 'lib/canon/errors.rb', line 24

def details
  @details
end

#formatObject (readonly)

Returns the value of attribute format.



24
25
26
# File 'lib/canon/errors.rb', line 24

def format
  @format
end

#lineObject (readonly)

Returns the value of attribute line.



24
25
26
# File 'lib/canon/errors.rb', line 24

def line
  @line
end