Although I didn't send mail, I logged the errors to Oracle. I setup a custom apache handler that called a mason component to handle the error with the error in the notes section. Maybe not the best way but it worked... You could create a mason component to send the mail instead of just logging it as i did.

I had my handler as follows:

package LsL::Mason;

use strict;
use HTML::Mason::ApacheHandler ();

{
 #  # install exported functions
  package HTML::Mason::Commands;
  use Lingua::EN::NameCase qw(nc);
}

my $ah;

$ah = HTML::Mason::ApacheHandler->new
        ( comp_root     => '/local/www',
          data_dir      => '/local/mason_data',
          allow_globals => [qw($PUser $PSession)],
          args_method   => 'mod_perl',
          error_mode    => 'output',
        );

sub handler {
  my ($r) = @_;

  return -1 unless $ah;

  # check for custom handler
  #my $script = LsL::Group::get_script($r->uri);

  my $return = eval { $ah->handle_request($r) };

  # check for error
  if (my $err = $@) {
    $r->pnotes( error => $err );
    $r->filename( $r->document_root . '/lib/server_error' );

    return $ah->handle_request($r);
  }

  return $return;
}

And /lib/server_error component:

<%flags>
 inherit => '/syshandler'
</%flags>
<%init>
 my $error = $r->pnotes('error');

 my $error_text = '[HTML/Mason Error] ';

$error_text .= UNIVERSAL::can( $error, 'as_text' ) ? $error->as_text : $error;

 $r->log_error($error_text);

 if ($error_text !~ /Connection reset by peer/) {
   my $caller = $m->caller_args(1);

   my $request = $m->scomp('/lib/url', path => $r->uri, query => $caller);

LsL::RequestAudit::request_insert($PUser->{'userid'}, 'INTERROR', $r->uri, $request, $error_text);
 }
</%init>

Custom HTML error page markup here.....

Cheers, Bill

On 01/06/2011 12:29 PM, Carlson, John W. wrote:

Is there some way to set up mason so I get an email when there's an error thrown to the error page (and hopefully not more than one for the same error).

John


------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl


_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to