NAME

Net::OpenSocial::Client::ErrorHandler - Error handler role

SYNOPSIS

package MyClass;
use Any::Moose;
with 'Net::OpenSocial::Client::ErrorHandler';
sub my_method {
    my $self = shift;
    if ( $self->found_any_error ) {
        return $self->ERROR('Error occured.');
    }
    return 1;
}

package main;
use MyClass;
my $foo = MyClass->new;
my $result = $foo->my_method
    or die $foo->errstr;

DESCRIPTION

Error handler role. This provides a simple way to handle error.

METHODS

ERROR( $message )

When some error occured, call like that

return $self->ERROR($error_message);

And this returns undef. After that, you can pick up the error message by calling 'errstr' method.

errstr

If it already called 'ERROR' method, it returns an error message.

die $self->errstr;

SEE ALSO

Class::ErrorHandler

AUTHOR

Lyo Kato, <lyo.kato@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Lyo Kato

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.