The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Games::Go::AGA::Parse::Exceptions - Exceptions classes for AGA Parsers

VERSION

version 0.042

SYNOPSIS

use Games::Go::AGA::Parse::Exceptions

DESCRIPTION

Defines an exception class for Games::Go::AGA::Parse modules.

The class stringifies to the normal error message. If a file is associated with the exception, the file name and the current line number are also included in the stringified message.

Fields defined for this exception class are:

    filename         # if we know the filename
    handle           # if we have the file handle
    line_number      # if we know the line_number in the file
    source           # source string that caused error

The fields are optional, but they help to make the error message more informative. If the Games::Go::AGA::Parsers are created with filename and/or handle options (or if they are set with accessor methods after new), any exceptions thrown by the parser will include the 'filename' and/or 'handle' fields set appropriately.

Throw a parser exception like this:

    Games::Go::AGA::Parse::Exception->throw(
        error       => 'What the heck just happened?',
        source      => 'line that caused the error',
        filename    => 'name of file, if known',
        handle      => 'file handle, if known',
        line_number => $current_line_number,
    );

Only error is strictly required. If handle is set, the exception will attempt to determine the line number by calling $handle->input_line_number. Otherwise the line_number field is used (if set).

NAME

Games::Go::AGA::Parse::Exceptions

SEE ALSO

Exception::Class

AUTHOR

Reid Augustin <reid@hellosix.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Reid Augustin.

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