XS::ErrorCode - Perl binding for panda::ErrorCode (nested std::error_code)
my $err = SomeFramework->some_method(); if ($err) { say $err; say $err->value; say $err->category->name; say $err->message; }
This binding is intended for use from XS modules that returns errors as panda::ErrorCode objects to perl. It provides them with typemap and Perl interface.
panda::ErrorCode
See XS::STL::ErrorCode for more info about error codes.
Creates nested error code object from XS::STL::ErrorCode and XS::ErrorCode. Normally you should not create these objects from perl.
XS::ErrorCode
Returns top error code value (integer)
Returns top error code category as XS::STL::ErrorCategory object
Returns top error message
Returns top error as XS::STL::ErrorCode object
Returns XS::ErrorCode object with next error as top error or undef if it constains a single error.
Example printing all errors in stack:
while ($err) { say $err->value; say $err->message; $err = $err->next; }
Returns true if object contains errors
Stringifies to whole stack of errors. Example output:
Connection timed out (110:generic), preceded by: Permission denied (13:generic)
Compares with XS::ErrorCode or XS::STL::ErrorCode or number. Only top error is compared.
my $err = SomeFramework->some_method(); if ($err == SomeFramework::Error::unauthorized) { } elsif ($err == XS::STL::errc::connection_refused) { }
Pronin Oleg <syber@crazypanda.ru>, Crazy Panda LTD
You may distribute this code under the same terms as Perl itself.
To install XS::Framework, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XS::Framework
CPAN shell
perl -MCPAN -e shell install XS::Framework
For more information on module installation, please visit the detailed CPAN module installation guide.