You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Cameron McBride <ca...@cwru.edu> on 2002/05/12 23:11:47 UTC

Handling Errors with 2.0b7

I am trying to establish better error handling with Embperl::Object
and 2.0b7.  As far as I can tell, my results showed no difference
between 2.0b5 and 2.0b7. Two problems:

1. First off, I could not seem to get Embperl to email errors to me,
   using the EMBPERL_MAIL_ERRORS_TO and associated configs.  Is this
   working?  Is there something else I need to do to make it work?

   Example (2.0b7 config): 
      EMBPERL_MAIL_ERRORS_TO cam@localhost
      EMBPERL_MAIL_ERRORS_LIMIT 0

2. Requesting missing documents under Embperl::Object (404 code).

   While using Embperl::Object, my preference is to return a 404 error
   when a file (say blah.html) is requested but does not exist.  I
   cannot seem to get this to happen.  I then want to use the apache
   config 'ErrorDocument' to redirect 404s to a script.
  
   I can only get a 404 message when my EMBPERL_OBJECT_BASE is not
   available.
  
   What I am doing: 
   
   (a) With EMBPERL_OBJECT_FALLBACK unset:
       Set EMBPERL_OPTIONS with one of 0,2,262144,262146
       (combinations of optDisableEmbperlErrorPage and optReturnError)
        
       Result:
       Either a 500 Error (Internal Server Error), or Embperl renders
       as much of the page as it can (ie the base, and nothing in the
       middle for the requested page).
      
   (b) Setting EMBPERL_OBJECT_FALLBACK:
       (same permutations of EMBPERL_OPTIONS)
   
       Result:
       as expected, the EMBPERL_OBJECT_FALLBACK page.
   
   There are several workarounds I can think of, but what seems to be
   the most logical to me is to use the EMBPERL_OBJECT_FALLBACK
   page to report that a file is missing and then log the error 
   using the apache request object:

   (in missing.html -- EMBPERL_OBJECT FALLBACK):
   [-
     $req = shift;
     use Apache::Log;
   
     ## for 2.0b5
     ## $req_rec->log->error(
         
     ## for 2.0b7  
     $req->apache_req->log->error(
       "File does not exist: ".$ENV{DOCUMENT_ROOT}.$ENV{REQUEST_URI}
      );
   -]
   <snip>

   This is supposed to look like the normal apache error in the logs,
   and it does.

   I would prefer to have Embperl return a 404, and then let Apache call
   what it needs to for the 404 (this way both Embperl and Non-Embperl
   pages are handled identically).  Can I make it work this way?   

Any suggestions or comments on either item would be appreciated.  If you
think I can do it a better / cleaner way -- feel free to share!

As usual, Vielen Dank!

Cameron


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


Re: Handling Errors with 2.0b7

Posted by Cameron McBride <ca...@cwru.edu>.
> > 1. First off, I could not seem to get Embperl to email errors to me,
> >    using the EMBPERL_MAIL_ERRORS_TO and associated configs.  Is this
> >    working?  Is there something else I need to do to make it work?
> >
> 
> Did you try the EMBPERL_MAIL_DEBUG? Does it give any informations?

Yes I did, and it gave me some info that lead me to believe it is some
problem with my non-Embperl configuration.  Unfortunately, I have not
had time to track it down and fix it, so I can not say for sure whats
up.  When I do, I will drop a note with what was wrong.

> > 2. Requesting missing documents under Embperl::Object (404 code).
> 
> I have fixed EO to return 404. I send you the update per private mail. Let
> me know if it works for you

Will do.  Thank you very much.

Cameron

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


Re: Handling Errors with 2.0b7

Posted by Cameron McBride <ca...@cwru.edu>.
> > 2. Requesting missing documents under Embperl::Object (404 code).
> 
> I have fixed EO to return 404. I send you the update per private mail. Let
> me know if it works for you

Sorry about the delay, but yes it returns the 404.  Thanks!!

However, it does *NOT* log the error to the apache error log -- is it
supposed to?  I am not sure if it should or not, but I did kind of
expect it to.  Should it report the error to the standard log?

Anyhow, thanks for the effort and help!

Cameron

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


Re: Handling Errors with 2.0b7

Posted by Gerald Richter <ri...@ecos.de>.
>
> 1. First off, I could not seem to get Embperl to email errors to me,
>    using the EMBPERL_MAIL_ERRORS_TO and associated configs.  Is this
>    working?  Is there something else I need to do to make it work?
>

Did you try the EMBPERL_MAIL_DEBUG? Does it give any informations?

>
> 2. Requesting missing documents under Embperl::Object (404 code).
>

I have fixed EO to return 404. I send you the update per private mail. Let
me know if it works for you

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: Handling Errors with 2.0b7

Posted by Gerald Richter - ecos gmbh <ri...@ecos.de>.
>
> 1. First off, I could not seem to get Embperl to email errors to me,
>    using the EMBPERL_MAIL_ERRORS_TO and associated configs.  Is this
>    working?  Is there something else I need to do to make it work?
>
>    Example (2.0b7 config):
>       EMBPERL_MAIL_ERRORS_TO cam@localhost
>       EMBPERL_MAIL_ERRORS_LIMIT 0
>

Mmh, this work for me, but maybe this is the same problem with the
configuration. You could try to set

EMBPERL_MAIL_DEBUG 1

and look in your syslog, to see if there are any mail server related
problems.

>
>    I would prefer to have Embperl return a 404, and then let Apache call
>    what it needs to for the 404 (this way both Embperl and Non-Embperl
>    pages are handled identically).  Can I make it work this way?
>

That's the way it should work (if you don't set any error related options
and no fallback page).

I take a closer look at it at the end of the week. (I have to finish a
project for tomorow, afterwards I have some more time to look at all these
Embperl issuse, then I will also look at the conf and .htaccess stuff)

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