Iterator::BreakOn::X - Declare exception classes for Iterator::BreakOn


Iterator-BreakOn documentation Contained in the Iterator-BreakOn distribution.

Index


Code Index:

NAME

Top

Iterator::BreakOn::X - Declare exception classes for Iterator::BreakOn

SYNOPSIS

Top

	package Iterator::BreakOn;

    use Iterator::BreakOn::Exceptions;

    do {
        Iterator::BreakOn::X->thrown('unknown error' );
    } if ($fatal_error);

DESCRIPTION

Top

This module declare a exception classes hierarchies for use on the Iterator::BreakOn package.

DIAGNOSTICS

Top

This is the list of exceptions:

Iterator::BreakOn::X::missing

Raise when a required parameter (i.e. datasource) is missing. Not recoverable.

Iterator::BreakOn::X::datasource

Raise when the next method fails.

Iterator::BreakOn::X::getmethod

Raise when the user supplied get method is not valid.

Iterator::BreakOn::X::invalid_event

Raise when an event object receives a invalid name.

Iterator::BreakOn::X::csvfail

Detected a fatal error in Text::CSV package.

DEPENDENCIES

Top

Exception::Class

BUGS AND LIMITATIONS

Top

There are no known bugs in this module. Please report problems to the author. Patches are welcome.

AUTHOR

Top

VĂ­ctor Moral <victor@taquiones.net>

LICENSE AND COPYRIGHT

Top


Iterator-BreakOn documentation Contained in the Iterator-BreakOn distribution.

package Iterator::BreakOn::X;
use strict;
use warnings;
use Carp;

our $VERSION = '0.2';

use Exception::Class(
    'Iterator::BreakOn::X' => {
        description =>  'Parent class',
    },
    'Iterator::BreakOn::X::datasource' => {
        isa         =>  'Iterator::BreakOn::X',
        description =>  'fatal error in next method of datasource',
    },

    'Iterator::BreakOn::X::missing' => {
        isa         =>  'Iterator::BreakOn::X',
        description =>  'missing required parameter',
        fields      =>  [ 'parameter' ],
    },

    'Iterator::BreakOn::X::getmethod' => {
        isa         =>  'Iterator::BreakOn::X',
        description =>  "object can't use the user supplied get method",
        fields      =>  [ 'get_method' ],
    },

    'Iterator::BreakOn::X::invalid_event' => {
        isa         =>  'Iterator::BreakOn::X',
        description =>  'received an invalid name for an event',
        fields      =>  [ 'name' ],
    },        

    'Iterator::BreakOn::X::csvfail' => {
        isa         =>  'Iterator::BreakOn::X',
        description =>  'fatal error in Text::CSV package',
    },

);

sub full_message {
    my  $self   =   shift;
    my  $msg    =      $self->message() 
                    || $self->description() 
                    || 'unknown error';

    return "fatal error: ${msg}";
}

1;
__END__