App::CamelPKI::Error - Camel-PKI Error management
use App::CamelPKI::Error; try { throw App::CamelPKI::Error::Internal("WRONG_NUMBER_ARGS"); } catch App::CamelPKI::Error with { warn "Oops, I made a boo-boo!"; };
package My::Facet; use Class::Facet from => "My::Object", on_error => \&App::CamelPKI::Error::Privilege::on_facet_error;
This class leverages the Error module, by the excellent Graham Barr and his buddies, to implement error management in Camel-PKI.
Unlike Error, try, with, finally, except and otherwise symbols are exported by default: no need to say use Error qw(:try); to import these.
use Error qw(:try);
Thrown when a programing issue occurs (for example when not respecting the documented API, using a bad number of arguments, ...).
Thrown when a file issue occurs. The incriminated file name must be passed as the parameter -IOfile, for example.
-IOfile
throw App::CamelPKI::Error::IO("cannot open file", -IOfile => $file);
The ->{-errorcode} field will be automatically set with the numerical value of $! (see "perlvar") when the error is thrown. The ->{-error} field will be automatically set whith the textual value of this same variable; note that this value depends on the active locale and therefore should not be tested by error catching code.
Thrown each time the owner of a facet, another object or a class with restricted privileges, try to exceeds those which were granted to it. To this effect, the App::CamelPKI::Error::Privilege also defines a on_facet_error function that can be installed as a Class::Facet error handler, as shown in "SYNOPSIS".
Thrown when an Camel-PKI database (typically App::CamelPKI::CADB) detects an error at the SQL level, as an invariant violation tentative or an insert of two values for an unique index.
Thrown when a Camel-PKI object or class is in a state which cannot be handled correctly (for example, private key and certificate already present on disk for a non corresponding service), or an asked operation which is no yet or anymore possible to perform (for example when App::CamelPKI::CA ask for a certificate generation when the AC key and certificate are not regulated).
Thrown in case of an error in the communication with an external process (for example failling to start an instance of App::CamelPKI::SysV::Apache).
Thrown when a Camel-PKI mecanism detects an error caused by a bad user action (or a bad usage in a web service client).
To install App::CamelPKI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::CamelPKI
CPAN shell
perl -MCPAN -e shell install App::CamelPKI
For more information on module installation, please visit the detailed CPAN module installation guide.