You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Kee Hinckley <na...@somewhere.com> on 2002/08/07 15:40:57 UTC
Trapping internal errors in HTML::EmbperlObject
I want my templates to catch errors on the executed file and display
a reasonable page instead. (And mail me the error.)
I tried this:
[- Execute({isa => 'SiteInit.html'}); -]
[-
my @errors;
Execute({inputfile => '*', errors => \@errors});
if (@errors) {
Execute({inputfile => "ierror.html", param => \@errors});
}
-]
and in ierror.html I display some stuff and then do:
HTML::Embperl::Mail::Execute ({inputfile =>
"$ENV{DOCUMENT_ROOT}/data/ierror.epl",
subject => "Internal Error on
$ENV{SERVER_NAME}",
from =>
'webmaster@masscharterschools.org',
to => $ENV{SERVER_ADMIN},
param => \@param,
}) ;
Oddly though, not only does that not get rid of the error page, it
dislays the error message twice:
[32683]ERR: 24: Line 124: Error in Perl code: Can't use an undefined
value as a HASH reference at
/usr/local/www/mcsa-stage/data/SWC/Commons.pm line 1326.
[32683]ERR: 24: Line 17: Error in Perl code: [32683]ERR: 24: Line
124: Error in Perl code: Can't use an undefined value as a HASH
reference at /usr/local/www/mcsa-stage/data/SWC/Commons.pm line 1326.
at /usr/lib/perl5/site_perl/5.005/i386-linux/HTML/Embperl/Mail.pm
line 56.
Apparently something isn't getting cleared, so the Mail::Execute fails.
I also tried setting optReturnError, but that doesn't appear to do
anything either.
--
Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/
I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Trapping internal errors in HTML::EmbperlObject
Posted by Gerald Richter <ri...@ecos.de>.
>
> Apparently something isn't getting cleared, so the Mail::Execute fails.
>
Yes, in 1.3.x you need to clear Embperl's internal error flag:
> I also tried setting optReturnError, but that doesn't appear to do
> anything either.
You need to set optReturnError
[-
$r = shift ;
my @errors;
Execute({inputfile => '*', errors => \@errors, options =>
HTML::Embperl::optReturnError});
$r -> Error = 0 ;
if (@errors) {
Execute({inputfile => "ierror.html", param => \@errors});
}
-]
Reseting the error flag isn't necessary in 2.0
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Trapping internal errors in HTML::EmbperlObject
Posted by Kee Hinckley <na...@somewhere.com>.
At 9:40 AM -0400 8/7/02, Kee Hinckley wrote:
>I want my templates to catch errors on the executed file and display
>a reasonable page instead. (And mail me the error.)
Related problem. I can't seem to handle 404 errors using
EmbperlObject either. The Execute fails and I get:
[88483]ERR: 30: Line 2: Not found
/usr/local/www/vhosts/masscharterschools.org/htdocs/fooasdf.html
on the resulting page.
I'm working around this using OBJECT_FALLBACK for now, although that
doesn't do quite what I want. However doing that found another
problem. It doesn't look like the tree is searched for the object
fallback. I would have thought it would have looked up the directory
structure for the file so that I could have different fallbacks for
different places.
--
Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/
I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org