=encoding utf-8

=head1 NAME

JSON::Schema::Validate::Error - JSON Schema Exception

=head1 SYNOPSIS

    use JSON::Schema::Validate::Error;
    my $ex = JSON::Schema::Validate::Error->new( $json_pointer, $error_message ) || 
        die( JSON::Schema::Validate::Error->error );

=head1 VERSION

    v0.1.0

=head1 DESCRIPTION

This class represents L<JSON::Schema::Validate> errors that are found upon validating the schema provided.

The objects of this class are overloadable, which means they stringify if called in a string context.

They can also be compared, such as:

    say $ex1 eq $ex2;

This will not check the two objects are the same, but rather tha their C<path> and their C<message> are identical.

=head1 CONSTRUCTOR

    my $ex = JSON::Schema::Validate::Error->new( $json_pointer, $error_message )

Instantiate a new L<JSON::Schema::Validate::Error> object, and returns it.

It takes the following parameters:

=over 4

=item * C<$json_pointer>

A JSON pointer representing the path in the JSON data where the error occurred.

=item * C<$error_message>

An error text message that describes the error.

=back

=head1 METHODS

=head2 as_string

    say $ex; # some/path/field: some error message

Returns the string representation of the error.

=head2 message

    $ex->message( "Some error" );
    $ex->message; # Some error

Sets or gets the object error message.

=head2 path

    $ex->path( $json_pointer );
    $ex->path; # /some/where/field

Sets or gets the object error path (JSON pointer).

=head1 THREAD SAFETY

This module is thread-safe.

It does not use nor manipulate global variables, and each instance of L<JSON::Schema::Validate::Error> is self-contained and does not share any mutable state across threads.

=head1 AUTHOR

Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>

=head1 SEE ALSO

L<JSON::Schema::Validate>

=head1 COPYRIGHT & LICENSE

Copyright(c) 2025 DEGUEST Pte. Ltd.

All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

=cut
