App-Music-ChordPro

 view release on metacpan or  search on metacpan

lib/ChordPro/lib/JSON/Relaxed/ErrorCodes.pm  view on Meta::CPAN

#! perl

use v5.26;
use utf8;

package  JSON::Relaxed::ErrorCodes;

use JSON::Relaxed::Parser; our $VERSION = $JSON::Relaxed::Parser::VERSION;

=head1 JSON::Relaxed::ErrorCodes -- Error messages

If the document cannot be parsed, JSON::Relaxed will normally throw an
exception.

In legacy mode, JSON::Relaxed returns an undefined
value instead and sets the following error indicators:

=over 4

=item * $JSON::Relaxed::err_id

A unique code for a specific error.

=item * $JSON::Relaxed::err_msg

An English description of the error, including an indication where the
error occurs.

=back

When using object-oriented mode, these can be easily retrieved using
the parser methods err_id() and err_msg().

Following is a list of all error codes in JSON::Relaxed:

=over 4

=item * C<missing-input>

No input was found. This can be caused by:

    $parser->decode()
    $parser->decode(undef)

=item * C<empty-input>

The string to be parsed has no content beside whitespace and comments.

    $parser->decode('')
    $parser->decode('   ')
    $parser->decode('/* whatever */')

=item * C<unclosed-inline-comment>

A comment was started with /* but was never closed. For example:

    $parser->decode('/*')

=item * C<invalid-structure-opening-character>

The document opens with an invalid structural character like a comma or colon.
The following examples would trigger this error.

    $parser->decode(':')
    $parser->decode(',')
    $parser->decode('}')
    $parser->decode(']')

=item * C<multiple-structures>

The document has multiple structures. JSON and RJSON only allow a document to
consist of a single hash, a single array, or a single string. The following



( run in 0.868 second using v1.01-cache-2.11-cpan-fe3c2283af0 )