NAME

JSON::Validator::Error - JSON::Validator error object

SYNOPSIS

use JSON::Validator::Error;
my $err = JSON::Validator::Error->new($path, $message);

DESCRIPTION

JSON::Validator::Error is a class representing validation errors from JSON::Validator.

ATTRIBUTES

message

my $str = $error->message;

A human readable description of the error. Defaults to empty string.

path

my $str = $error->path;

A JSON pointer to where the error occurred. Defaults to "/".

METHODS

new

my $error = JSON::Validator::Error->new($path, $message);

Object constructor.

to_string

my $str = $error->to_string;

Returns the "path" and "message" part as a string: "$path: $message".

OPERATORS

JSON::Validator::Error overloads the following operators:

bool

my $bool = !!$error;

Always true.

stringify

my $str = "$error";

Alias for "to_string".

SEE ALSO

JSON::Validator.