SchemaValidationError
extends RuntimeException
in package
implements
HasCategory, HasOffset
FinalYes
Thrown by {@see Validator}/{@see \JOetjen\Dextrin\Schema} for a value that violates its schema, with the violation's DXN.md §5 category (`schema/missing-field`, ...), which every channel passes on unchanged. Null only where a caller asked for something that is not a DXN error at all, such as a schema that was never registered.
Table of Contents
Interfaces
- HasCategory
- Implemented by any exception that knows its DXN.md §5 category -- `syntax`, `binary`, `encode/unsupported`, ... -- so {@see DXNError::wrap()} can carry it across without knowing every concrete exception class, the way {@see HasOffset} carries an offset.
- HasOffset
- Implemented by any exception that can report a byte/character offset into the source it failed on (lexer/parser errors) -- lets {@see DXNError::wrap()} preserve that offset without needing to know about every concrete exception class in the text/binary pipelines.
Properties
Methods
- __construct() : mixed
- category() : string|null
- The category, or null for an exception that has none.
- offset() : int|null
- placedAt() : self
- This violation, placed at `$offset`, the struct it was found in -- the first place found, the innermost struct, wins.
Properties
$at
private
int|null
$at
= null
$category read-only
private
string|null
$category
= null
Methods
__construct()
public
__construct(string $message[, string|null $category = null ][, Throwable|null $previous = null ]) : mixed
Parameters
- $message : string
- $category : string|null = null
- $previous : Throwable|null = null
category()
The category, or null for an exception that has none.
public
category() : string|null
Return values
string|nulloffset()
public
offset() : int|null
Return values
int|nullplacedAt()
This violation, placed at `$offset`, the struct it was found in -- the first place found, the innermost struct, wins.
public
placedAt(int $offset) : self
Parameters
- $offset : int