You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by Peter Beardsley <pb...@appropriatesolutions.com> on 2004/11/24 15:38:56 UTC
exception handling under Apache::ASP
Hi,
This might be a more general mod_perl question, and if so let me know,
but I'm trying to add exception handling to my Apache::ASP code.
Basically I have a module that encapsulates all my data access, with all
the UI logic handled in ASP pages. What I want to do is throw
exceptions in the data module, and catch them in the ASP pages. I've
been using Error::Simple and throwing errors in the data module like so:
throw Error::Simple( 'My Error');
the calling code in the ASP page looks like so:
try {
Data::DataRoutine();
}
catch Error::Simple with {
my $E;
$Response->Write($E);
}
But the throw always triggers an Apache error and gets written to the
Apache log. I've also tried the module Exception::Class with similar
results.
Can anybody with experience doing exception handling under Apache::ASP
tell me what works for them and point me in the right direction?
Thanks,
-Peter.
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: exception handling under Apache::ASP
Posted by Josh Chamas <jo...@chamas.com>.
Peter Beardsley wrote:
> Hi,
> This might be a more general mod_perl question, and if so let me know,
> but I'm trying to add exception handling to my Apache::ASP code.
> Basically I have a module that encapsulates all my data access, with all
> the UI logic handled in ASP pages. What I want to do is throw
> exceptions in the data module, and catch them in the ASP pages. I've
> been using Error::Simple and throwing errors in the data module like so:
>
> throw Error::Simple( 'My Error');
>
> the calling code in the ASP page looks like so:
>
> try {
> Data::DataRoutine();
> }
> catch Error::Simple with {
> my $E;
> $Response->Write($E);
> }
>
> But the throw always triggers an Apache error and gets written to the
> Apache log. I've also tried the module Exception::Class with similar
> results.
>
> Can anybody with experience doing exception handling under Apache::ASP
> tell me what works for them and point me in the right direction?
>
Well, I'm pretty old fashioned in this regards, but I rely on die() for
my error throwing, and eval {} for my error catching, and just check
for whether $@ exists after the eval {} to see if there was an error.
BTW, sorry for not getting back for so long. I am been swamped with
work recently.
Regards,
Josh
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org