I'm using Sleepycat DbXml (2.1.7) with AxKit.
This is a question about mixing non-Error.pm exception objects with Error.pm exceptions.
This is not an urgent question - as I can currently identify the error messages using a quick hack (see below)
but I would like to know if there is a cleaner way to do this (in either package)
or an idea of the work involved.
I've written an AxContentProvider to retrieve documents from Sleepycat containers.
All works fine - as long as there are no errors.
However I think Sleepycat uses it's own XMLException class and Carp::croak for all it's errors(?)
rather than Error.pm - which is what AxKit uses(?).
So I'm getting error messages about unknown 'throws in Axkit - rather than the Sleepycat error message.
It looks like the AxKit $SIG{__DIE__} handler is assuming all errors are either AxKit / Error.pm Exceptions or simple strings.
It looks like I can achieve the error reporting I need in the short term by one simple hack in Axkit's prep_exception
sub prep_exception {
my $err = shift; if (ref($err) =~ /std::exception|XmlException/i) {
return Apache::AxKit::Exception::Error->new(-text => $err->what());
}
elsif (ref($err)) {
return $err;
}
elsif ($err) {
return Apache::AxKit::Exception::Error->new(-text => $err);
}
else {
return;
}
}Is this all I would need to do to deal with non-AxKit errors in AxKit?
(and would using UNIVERSAL::isa($err, 'Error' be a correct and better way to trap Error.pm errors?)
Is this all I would need to do to catch DbXML errors (i.e. would they all be XmlExceptions or std::exception)?
Does anyone using AxKit or DbXml have any experience of another 'clean' way to do this?
(My experience with error handling is limited to my own code.)
Has anyone replaced DbXml's XmlException handling with an Error.pm wrapper? (or have any suggestions about how to do this?)
Any help appreciated.
Mike
-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 06/05/2005
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
