|
From: Chris W. <la...@us...> - 2001-10-17 04:47:11
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract/Error
In directory usw-pr-cvs1:/tmp/cvs-serv25485/OpenInteract/Error
Modified Files:
Main.pm System.pm
Log Message:
modify to reflect server configuration file changes
Index: Main.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/Error/Main.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Main.pm 2001/10/04 13:21:35 1.5
--- Main.pm 2001/10/17 04:47:07 1.6
***************
*** 52,61 ****
$handler_info->{ lc $action } = $action_info->{ lc $action }{error};
}
! $handler_info->{'_DEFAULT_HANDLER'} = $p->{config}{default_error_handler};
$class->require_error_handlers( $handler_info );
! my $stash_class = $p->{config}{stash_class};
$stash_class->set_stash( 'error_handlers', $handler_info );
! $R->DEBUG && $R->scrib( 1, "Initialized DEFAULT_HANDLER for app ",
! "$p->{stash_class} to $handler_info->{'_DEFAULT_HANDLER'}" );
}
--- 52,62 ----
$handler_info->{ lc $action } = $action_info->{ lc $action }{error};
}
! $handler_info->{'_DEFAULT_HANDLER'} = $p->{config}{error}{default_error_handler} ||
! $p->{config}{default_error_handler};
$class->require_error_handlers( $handler_info );
! my $stash_class = $p->{config}{server_info}{stash_class};
$stash_class->set_stash( 'error_handlers', $handler_info );
! $R->DEBUG && $R->scrib( 1, "Initialized DEFAULT_HANDLER for app",
! "($stash_class) to ($handler_info->{'_DEFAULT_HANDLER'})" );
}
Index: System.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/Error/System.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** System.pm 2001/08/24 20:35:33 1.2
--- System.pm 2001/10/17 04:47:07 1.3
***************
*** 65,69 ****
# Since we can handle any code, we move the checking phase to the error handler
! sub can_handle_error {
my ( $class, $err ) = @_;
--- 65,69 ----
# Since we can handle any code, we move the checking phase to the error handler
! sub can_handle_error {
my ( $class, $err ) = @_;
***************
*** 74,78 ****
# 2) 510 -> not found -> 500
! my $start = $CODE_SEEK;
my $info = $OpenInteract::Error::System::CODES->{ $err->{code} };
while ( ! $info ) {
--- 74,78 ----
# 2) 510 -> not found -> 500
! my $start = $CODE_SEEK;
my $info = $OpenInteract::Error::System::CODES->{ $err->{code} };
while ( ! $info ) {
***************
*** 107,129 ****
my $R = OpenInteract::Request->instance;
my $C = $R->CONFIG;
! $err->{error_id} = $err->generate_random_code( 16 );
!
# First send an email
my $msg = <<MSG;
! Website Name: $C->{website_name}
! Something terrible has happened: I cannot connect to
! the database or a previous connection has been dropped.
! If you do not fix this soon, you will have an angry
mob of users on your hands.
Error Code: $err->{error_id}
! (written out to $R->{dir}->{base}/error)
!
Your friendly OpenInteract System
MSG
! eval { OpenInteract::Utility->send_email({ to => $R->CONFIG->{admin_email},
message => $msg,
subject => 'Cannot connect to database!' }) };
--- 107,130 ----
my $R = OpenInteract::Request->instance;
my $C = $R->CONFIG;
! $err->{error_id} = $err->generate_random_code( 16 );
!
# First send an email
my $msg = <<MSG;
! Website Name: $C->{server_info}{website_name}
! Something terrible has happened: I cannot connect to
! the database or a previous connection has been dropped.
! If you do not fix this soon, you will have an angry
mob of users on your hands.
Error Code: $err->{error_id}
! (written out to $R->{dir}{base}/error)
!
Your friendly OpenInteract System
MSG
! eval { OpenInteract::Utility->send_email({ to => $R->CONFIG->{mail}{admin_email} ||
! $R->CONFIG->{admin_email},
message => $msg,
subject => 'Cannot connect to database!' }) };
***************
*** 131,136 ****
$err->{notes} = "Cannot send email to admin; saved email msg";
$R->throw({ code => 203 });
! }
! else {
$err->{notes} = 'E-mail sent to admin ok.';
}
--- 132,137 ----
$err->{notes} = "Cannot send email to admin; saved email msg";
$R->throw({ code => 203 });
! }
! else {
$err->{notes} = 'E-mail sent to admin ok.';
}
***************
*** 162,166 ****
cluck ">> Error: cannot parse template. $err->{tmp_filename} / $err->{system_msg}" if ( DEBUG );
$err->{user_msg} = 'Could not process template';
! $err->{notes} = "Filename tried to open: $err->{tmp_filename} (if blank, we used text passed in)";
OpenInteract::Error::Main->save_error( $err );
return "[[ error processing directive: template error ]]";
--- 163,167 ----
cluck ">> Error: cannot parse template. $err->{tmp_filename} / $err->{system_msg}" if ( DEBUG );
$err->{user_msg} = 'Could not process template';
! $err->{notes} = "Filename tried to open: $err->{tmp_filename} (if blank, we used text passed in)";
OpenInteract::Error::Main->save_error( $err );
return "[[ error processing directive: template error ]]";
***************
*** 173,181 ****
OpenInteract::Error::Main->save_error( $err );
my $R = OpenInteract::Request->instance;
! my $filename = $R->CONFIG->get_dir( 'mail' ) . "/msg_$err->{error_id}";
eval { open( MAIL, "> $filename" ) || die $! };
if ( $@ ) {
! $R->scrib( 0, "Good gravy! I cannot send an email, and I cannot open up a file to dump\n",
! "the email into. (Tried: (($filename)) and got (($@)) in return.)\n",
"I'll just put it into STDERR and you can deal with it.\n\n", Dumper( $mail_info ), "\n" );
return undef;
--- 174,182 ----
OpenInteract::Error::Main->save_error( $err );
my $R = OpenInteract::Request->instance;
! my $filename = $R->CONFIG->get_dir( 'mail' ) . "/msg_$err->{error_id}";
eval { open( MAIL, "> $filename" ) || die $! };
if ( $@ ) {
! $R->scrib( 0, "Good gravy! I cannot send an email, and I cannot open up a file to dump\n",
! "the email into. (Tried: (($filename)) and got (($@)) in return.)\n",
"I'll just put it into STDERR and you can deal with it.\n\n", Dumper( $mail_info ), "\n" );
return undef;
***************
*** 207,211 ****
$err->{system_msg} = "Please create entries in your 'conf/server.perl' file under " .
"the 'login->login_field' and 'login->password_field' keys. I cannot " .
! "process logins until this is done. Remember to restart the server after " .
"you have made the change.";
OpenInteract::Error::Main->save_error( $err );
--- 208,212 ----
$err->{system_msg} = "Please create entries in your 'conf/server.perl' file under " .
"the 'login->login_field' and 'login->password_field' keys. I cannot " .
! "process logins until this is done. Remember to restart the server after " .
"you have made the change.";
OpenInteract::Error::Main->save_error( $err );
***************
*** 222,226 ****
OpenInteract::Error::Main->save_error( $err );
my $R = OpenInteract::Request->instance;
! $R->{page}->{title} = 'Sorry: File not found';
my $html = $R->template->handler( {}, { err => $err }, { db => 'err_not_found',
package => 'base_error' } );
--- 223,227 ----
OpenInteract::Error::Main->save_error( $err );
my $R = OpenInteract::Request->instance;
! $R->{page}{title} = 'Sorry: File not found';
my $html = $R->template->handler( {}, { err => $err }, { db => 'err_not_found',
package => 'base_error' } );
***************
*** 240,246 ****
cluck ">> Error: Cannot do task due to security: $err->{system_msg}" if ( DEBUG );
my $R = OpenInteract::Request->instance;
! my $html = $R->template->handler( {},
! { err => $err,
! admin_email => $R->CONFIG->{admin_email} },
{ db => 'err_task_forbidden',
package => 'base_error' } );
--- 241,248 ----
cluck ">> Error: Cannot do task due to security: $err->{system_msg}" if ( DEBUG );
my $R = OpenInteract::Request->instance;
! my $html = $R->template->handler( {},
! { err => $err,
! admin_email => $R->CONFIG->{mail}{admin_email} ||
! $R->CONFIG->{admin_email} },
{ db => 'err_task_forbidden',
package => 'base_error' } );
***************
*** 251,255 ****
sub task_no_default {
my ( $err ) = @_;
! $err->{user_msg} = 'No default method defined';
cluck ">> Error: Cannot do task due to no default: $err->{system_msg}" if ( DEBUG );
my $R = OpenInteract::Request->instance;
--- 253,257 ----
sub task_no_default {
my ( $err ) = @_;
! $err->{user_msg} = 'No default method defined';
cluck ">> Error: Cannot do task due to no default: $err->{system_msg}" if ( DEBUG );
my $R = OpenInteract::Request->instance;
***************
*** 257,261 ****
# First send an email
! eval { OpenInteract::Utility->send_email({ to => $err->{tmp_email},
message => $err->{tmp_msg},
subject => $err->{tmp_subject} }) };
--- 259,263 ----
# First send an email
! eval { OpenInteract::Utility->send_email({ to => $err->{tmp_email},
message => $err->{tmp_msg},
subject => $err->{tmp_subject} }) };
***************
*** 263,273 ****
$err->{notes} = "Cannot send email to author; saved email msg";
$R->throw({ code => 203 });
! }
else {
$err->{notes} = 'E-mail sent to author ok.';
}
OpenInteract::Error::Main->save_error( $err );
! my $html = $R->template->handler( {},
! { err => $err,
author_email => $err->{tmp_email} },
{ db => 'err_task_no_default',
--- 265,275 ----
$err->{notes} = "Cannot send email to author; saved email msg";
$R->throw({ code => 203 });
! }
else {
$err->{notes} = 'E-mail sent to author ok.';
}
OpenInteract::Error::Main->save_error( $err );
! my $html = $R->template->handler( {},
! { err => $err,
author_email => $err->{tmp_email} },
{ db => 'err_task_no_default',
***************
*** 281,287 ****
cluck ">> Error: Cannot accomplish task due to security." if ( DEBUG );
my $R = OpenInteract::Request->instance;
! my $html = $R->template->handler( {},
{ err => $err,
! admin_email => $R->CONFIG->{admin_email} },
{ db => 'err_task_forbidden',
package => 'base_error' } );
--- 283,290 ----
cluck ">> Error: Cannot accomplish task due to security." if ( DEBUG );
my $R = OpenInteract::Request->instance;
! my $html = $R->template->handler( {},
{ err => $err,
! admin_email => $R->CONFIG->{mail}{admin_email} ||
! $R->CONFIG->{admin_email} },
{ db => 'err_task_forbidden',
package => 'base_error' } );
***************
*** 298,305 ****
my $msg = <<'';
! For some reason beyond security, a user could not retrieve an object
given a particular ID. You might want to look into it.
! eval { OpenInteract::Utility->send_email({ to => $R->CONFIG->{admin_email},
message => $msg,
subject => 'Failed to retrieve object' }) };
--- 301,309 ----
my $msg = <<'';
! For some reason beyond security, a user could not retrieve an object
given a particular ID. You might want to look into it.
! eval { OpenInteract::Utility->send_email({ to => $R->CONFIG->{mail}{admin_email} ||
! $R->CONFIG->{admin_email},
message => $msg,
subject => 'Failed to retrieve object' }) };
***************
*** 307,311 ****
$err->{notes} = "Cannot send email to admin; saved email msg";
$R->throw( { code => 203 } );
! }
else {
$err->{notes} = 'E-mail sent to admin ok.';
--- 311,315 ----
$err->{notes} = "Cannot send email to admin; saved email msg";
$R->throw( { code => 203 } );
! }
else {
$err->{notes} = 'E-mail sent to admin ok.';
***************
*** 321,325 ****
$R->scrib( 0, "Cannot create session -- someone is probably using a ",
"defunct key or something." );
! $R->cookies->create_cookie({
name => $OpenInteract::Session::COOKIE_NAME,
path => '/',
--- 325,329 ----
$R->scrib( 0, "Cannot create session -- someone is probably using a ",
"defunct key or something." );
! $R->cookies->create_cookie({
name => $OpenInteract::Session::COOKIE_NAME,
path => '/',
***************
*** 336,340 ****
cluck ">> Error: User $err->{tmp_login_name} not found in system" if ( DEBUG );
my $R = OpenInteract::Request->instance;
! $R->{ $ERROR_HOLD }->{loginbox}->{bad_login} = "User $err->{tmp_login_name} not found!";
return undef;
}
--- 340,344 ----
cluck ">> Error: User $err->{tmp_login_name} not found in system" if ( DEBUG );
my $R = OpenInteract::Request->instance;
! $R->{ $ERROR_HOLD }{loginbox}{bad_login} = "User $err->{tmp_login_name} not found!";
return undef;
}
***************
*** 344,349 ****
cluck ">> Error: User $err->{tmp_login_name} login with wrong password" if ( DEBUG );
my $R = OpenInteract::Request->instance;
! $R->{ $ERROR_HOLD }->{loginbox}->{bad_login} = "Bad password for $err->{tmp_login_name}; try again.";
! $R->{ $ERROR_HOLD }->{loginbox}->{login_name} = $err->{tmp_login_name};
return undef;
}
--- 348,353 ----
cluck ">> Error: User $err->{tmp_login_name} login with wrong password" if ( DEBUG );
my $R = OpenInteract::Request->instance;
! $R->{ $ERROR_HOLD }{loginbox}{bad_login} = "Bad password for $err->{tmp_login_name}; try again.";
! $R->{ $ERROR_HOLD }{loginbox}{login_name} = $err->{tmp_login_name};
return undef;
}
***************
*** 416,424 ****
=over 4
! =item *
10: cannot_parse_config
! =item *
11: cannot_connect_db
--- 420,428 ----
=over 4
! =item *
10: cannot_parse_config
! =item *
11: cannot_connect_db
***************
*** 430,434 ****
=over 4
! =item *
(none currently)
--- 434,438 ----
=over 4
! =item *
(none currently)
|