You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Jordan Baker <su...@rogers.com> on 2002/11/23 06:08:09 UTC

Embperl::Object and ErrorDocument

Aha, well I discovered something by testing tonite.

I do a couple Execute calls in my base.epl and essentially they hide the error 
from the parent process.

So I have to find a way to propogate errors.. perhaps there is an option to 
Execute to propogate errors when you call another document but it apparently 
does not work in this case... ie. execution will continue.

So my temporary work around is to rethrow the errors I receive in this case...

The only annoying thing is that I need to do this for any file I Execute from 
the base.epl and it gets a bit redundant.. which is why it would be nice to 
be able to propogate the error back to the top unless you have "errors" set 
to something.

my $errs = [];
Execute({inputfile => "*", errors => $errs});
# rethrow error
die join("\n", @$errs) if $errs;

Anyone else using Embperl::Object who has any other advice?? This will help me 
in a basic regard anway so I'm mostly happy :)

-- 
Jordan Baker
jbb@contradix.com


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Embperl::Object and ErrorDocument

Posted by Ed Grimm <ed...@asgard.rsc.raytheon.com>.
Have a per-request data store (such as the Apache request record) in
which you place your error messages.  So, instead of 'my $errs', you
have something like '$r->errs'.  (Please note that I don't actually use
the Apache request record for this; as such, I don't know if that was
the right syntax for doing so, nor do I know if I managed to step on a
pre-existing Apache request record key.)

I find myself using this sort of mechanism more frequently for general
deep parameter passing.  (That is, I have a subroutine which is six
calls deep called from the first Embperl block; it aquires data which is
needed by a subroutine eight calls deep, called from the third Embperl
block.  Either I need to pass that variable through fourteen subroutine
calls (well, six returns and eight calls), or I need to use a global
(evil, evil), or I need to do something like this.)

If you do this but don't use the Apache request record, you need to be
careful to clean up your data after each request, and you either need to
use a non-threaded webserver, or you need to be careful to remain
thread-safe.

Ed

On Sat, 23 Nov 2002, Jordan Baker wrote:

> Aha, well I discovered something by testing tonite.
>
> I do a couple Execute calls in my base.epl and essentially they hide
> the error from the parent process.
>
> So I have to find a way to propogate errors.. perhaps there is an
> option to Execute to propogate errors when you call another document
> but it apparently does not work in this case... ie. execution will
> continue.
>
> So my temporary work around is to rethrow the errors I receive in this
> case...
>
> The only annoying thing is that I need to do this for any file I
> Execute from the base.epl and it gets a bit redundant.. which is why
> it would be nice to be able to propogate the error back to the top
> unless you have "errors" set to something.
>
> my $errs = [];
> Execute({inputfile => "*", errors => $errs});
> # rethrow error
> die join("\n", @$errs) if $errs;
>
> Anyone else using Embperl::Object who has any other advice?? This will
> help me in a basic regard anway so I'm mostly happy :)
>
> --
> Jordan Baker
> jbb@contradix.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Embperl::Object and ErrorDocument

Posted by Kee Hinckley <na...@somewhere.com>.
At 10:33 AM -0200 11/24/02, Luiz Fernando B. Ribeiro wrote:
>I use a [$ sub error $] in my base.epl that do do all the error handling
>and in the end it exits with a normal exit;
>
>In my other pages after any eval {}; or other error I call that sub with
>$req->error('tittle', 'page', $error);
>
>It works fine with Embperl 1.3.4.

My EmbperlObject templates check the Execute result (and \@errors) 
and if there is an error, they clear it and then executes an error 
page.

However that doesn't address the problem of an error in an Execute 
several levels down the call chain.  It also runs into problems if 
you've done any output before displaying the error page (that's why I 
requested recently that the Perl interface be given access to the 
ability to clear the current output buffer).
-- 

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: Embperl::Object and ErrorDocument

Posted by "Luiz Fernando B. Ribeiro" <lu...@engenhosolucoes.com.br>.
Em Sat, 23 Nov 2002 00:08:09 -0500
Jordan Baker <su...@rogers.com> escreveu:

> Aha, well I discovered something by testing tonite.
> 
> I do a couple Execute calls in my base.epl and essentially they hide
> the error from the parent process.
> 
> So I have to find a way to propogate errors.. perhaps there is an
> option to Execute to propogate errors when you call another document
> but it apparently does not work in this case... ie. execution will
> continue.
> 
> So my temporary work around is to rethrow the errors I receive in this
> case...
> 
> The only annoying thing is that I need to do this for any file I
> Execute from the base.epl and it gets a bit redundant.. which is why
> it would be nice to be able to propogate the error back to the top
> unless you have "errors" set to something.
> 
> my $errs = [];
> Execute({inputfile => "*", errors => $errs});
> # rethrow error
> die join("\n", @$errs) if $errs;
> 
> Anyone else using Embperl::Object who has any other advice?? This will
> help me in a basic regard anway so I'm mostly happy :)
> 

Hi,

I use a [$ sub error $] in my base.epl that do do all the error handling
and in the end it exits with a normal exit;

In my other pages after any eval {}; or other error I call that sub with
$req->error('tittle', 'page', $error);

It works fine with Embperl 1.3.4.

Regards,

Luiz Fernando B. Ribeiro
Engenho Soluções para a Internet

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Embperl::Object and ErrorDocument

Posted by Gerald Richter <ri...@ecos.de>.

> By "hide the error" I mean that if an ErrorDocument 500 is enabled in
> httpd.conf, EMBPERL_OPTIONS is set to return the error in the Apache
request,
> and I call a template in base.epl that causes an error then it seems to
> simply abort that current template and continue on, as opposed to showing
me
> a proper traceback.
>

Ah, I see the problem. Yes, I have to rework this logic. It is from times
without Embperl::Object, were it works pretty well, but with Embperl::Object
it doesn't work as well.

For now I can't do much for you, but I will address this problem in one of
the next releases

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: Embperl::Object and ErrorDocument

Posted by Jordan Baker <su...@rogers.com>.
By "hide the error" I mean that if an ErrorDocument 500 is enabled in 
httpd.conf, EMBPERL_OPTIONS is set to return the error in the Apache request, 
and I call a template in base.epl that causes an error then it seems to 
simply abort that current template and continue on, as opposed to showing me 
a proper traceback.

It works fine if you pass an errors arrayref and then check it after the 
execution however it does seem that ideally it should work as you describe.

On November 26, 2002 02:15 am, Gerald Richter wrote:
> > I do a couple Execute calls in my base.epl and essentially they hide the
>
> error
>
> > from the parent process.
>
> What do you mean by "hide the error"? If a error happens anywhere, you
> should get an error page, don't you?
>
> Errors should propgate to the parent, unles you use the errors => parameter
> (or the optReturnError option)
>
> 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
> -------------------------------------------------------------

-- 
Jordan Baker
jbb@contradix.com


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Embperl::Object and ErrorDocument

Posted by Gerald Richter <ri...@ecos.de>.
>
> I do a couple Execute calls in my base.epl and essentially they hide the
error
> from the parent process.
>

What do you mean by "hide the error"? If a error happens anywhere, you
should get an error page, don't you?

Errors should propgate to the parent, unles you use the errors => parameter
(or the optReturnError option)

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