Exception: Coradoc::ValidationError

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

Overview

Error raised when validation fails

Examples:

raise ValidationError.new(
  "Invalid document structure",
  errors: ["Missing title", "Empty section"]
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, errors: []) ⇒ ValidationError

Create a new validation error

Parameters:

  • message (String)

    The error message

  • errors (Array<String>) (defaults to: [])

    List of specific validation errors



229
230
231
232
# File 'lib/coradoc/errors.rb', line 229

def initialize(message, errors: [])
  @errors = errors
  super(build_message(message))
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



223
224
225
# File 'lib/coradoc/errors.rb', line 223

def errors
  @errors
end