|
From: Chris W. <la...@us...> - 2001-10-28 02:41:37
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract/Error
In directory usw-pr-cvs1:/tmp/cvs-serv10071/OpenInteract/Error
Modified Files:
System.pm
Log Message:
use $R->DEBUG instead of the local DEBUG
Index: System.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/Error/System.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** System.pm 2001/10/24 03:01:58 1.4
--- System.pm 2001/10/28 02:41:34 1.5
***************
*** 13,18 ****
my $ERROR_HOLD = $OpenInteract::Error::Main::ERROR_HOLD;
- use constant DEBUG => 0;
-
# Increment at which we should break down
# codes if not found (change to 100 for more macro)
--- 13,16 ----
***************
*** 89,93 ****
sub cannot_parse_config {
my ( $err ) = @_;
! cluck ">> Error: Cannot open/parse config file. $err->{tmp_filename} / $err->{system_msg}" if ( DEBUG );
$err->{notes} = "Filename tried to open: $err->{tmp_filename}";
OpenInteract::Error::Main->save_error( $err );
--- 87,93 ----
sub cannot_parse_config {
my ( $err ) = @_;
! my $R = OpenInteract::Request->instance;
! $R->DEBUG && cluck ">> Error: Cannot open/parse config file.",
! "$err->{tmp_filename} / $err->{system_msg}";
$err->{notes} = "Filename tried to open: $err->{tmp_filename}";
OpenInteract::Error::Main->save_error( $err );
***************
*** 104,109 ****
sub cannot_connect_db {
my ( $err ) = @_;
- cluck ">> Error: Cannot connect to db. Info:\n", Dumper( $err->{tmp_db_info} ) if ( DEBUG );
my $R = OpenInteract::Request->instance;
my $C = $R->CONFIG;
$err->{error_id} = $err->generate_random_code( 16 );
--- 104,110 ----
sub cannot_connect_db {
my ( $err ) = @_;
my $R = OpenInteract::Request->instance;
+ $R->DEBUG && cluck ">> Error: Cannot connect to db. Info:\n",
+ Dumper( $err->{tmp_db_info} ) ;
my $C = $R->CONFIG;
$err->{error_id} = $err->generate_random_code( 16 );
***************
*** 151,155 ****
sub cannot_open_template {
my ( $err ) = @_;
! cluck ">> Error: cannot open template. $err->{tmp_filename} / $err->{system_msg}" if ( DEBUG );
$err->{user_msg} = 'Could not open template file';
$err->{notes} = "Filename tried to open: $err->{tmp_filename}";
--- 152,158 ----
sub cannot_open_template {
my ( $err ) = @_;
! my $R = OpenInteract::Request->instance;
! $R->DEBUG && cluck ">> Error: cannot open template.",
! "$err->{tmp_filename} / $err->{system_msg}";
$err->{user_msg} = 'Could not open template file';
$err->{notes} = "Filename tried to open: $err->{tmp_filename}";
***************
*** 161,165 ****
sub cannot_parse_template {
my ( $err ) = @_;
! 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)";
--- 164,170 ----
sub cannot_parse_template {
my ( $err ) = @_;
! my $R = OpenInteract::Request->instance;
! $R->DEBUG && cluck ">> Error: cannot parse template.",
! "$err->{tmp_filename} / $err->{system_msg}";
$err->{user_msg} = 'Could not process template';
$err->{notes} = "Filename tried to open: $err->{tmp_filename} (if blank, we used text passed in)";
***************
*** 194,198 ****
sub cannot_open_template_db {
my ( $err ) = @_;
! cluck ">> Error: cannot open template. $err->{tmp_name} / $err->{system_msg}" if ( DEBUG );
$err->{user_msg} = 'Could not open template from database';
$err->{notes} = "Tag tried to open with: $err->{tmp_name}";
--- 199,205 ----
sub cannot_open_template_db {
my ( $err ) = @_;
! my $R = OpenInteract::Request->instance;
! $R->DEBUG && cluck ">> Error: cannot open template.",
! "$err->{tmp_name} / $err->{system_msg}";
$err->{user_msg} = 'Could not open template from database';
$err->{notes} = "Tag tried to open with: $err->{tmp_name}";
***************
*** 204,208 ****
sub cannot_find_login_fields {
my ( $err ) = @_;
! cluck ">> Error: cannot find login/password fields!" if ( DEBUG );
$err->{user_msg} = 'No login/password fields specified!';
$err->{system_msg} = "Please create entries in your 'conf/server.perl' file under " .
--- 211,216 ----
sub cannot_find_login_fields {
my ( $err ) = @_;
! my $R = OpenInteract::Request->instance;
! $R->DEBUG && cluck ">> Error: cannot find login/password fields!";
$err->{user_msg} = 'No login/password fields specified!';
$err->{system_msg} = "Please create entries in your 'conf/server.perl' file under " .
***************
*** 217,228 ****
#300
sub file_not_found {
my ( $err ) = @_;
! cluck ">> Error: cannot find or open requested file: $err->{system_msg}" if ( DEBUG );
$err->{user_msg} = 'Requested file not found or cannot be opened';
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 }, { name => 'error_not_found' } );
die "$html\n";
}
--- 225,239 ----
#300
+ # Syntax: $R->throw({ code => 314, system_msg => '/location/notfound' });
+
sub file_not_found {
my ( $err ) = @_;
! my $R = OpenInteract::Request->instance;
! $R->DEBUG && cluck ">> Error: cannot find or open requested location *$err->{system_msg})";
$err->{user_msg} = 'Requested file not found or cannot be opened';
OpenInteract::Error::Main->save_error( $err );
! $R->{page}{title} = 'Sorry: Action not found';
! my $html = $R->template->handler( {}, { err => $err },
! { name => 'error_not_found' } );
die "$html\n";
}
***************
*** 238,243 ****
sub task_is_forbidden {
my ( $err ) = @_;
- 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,
--- 249,254 ----
sub task_is_forbidden {
my ( $err ) = @_;
my $R = OpenInteract::Request->instance;
+ $R->DEBUG && cluck ">> Error: Cannot perform task due to security ($err->{system_msg})";
my $html = $R->template->handler( {},
{ err => $err,
***************
*** 251,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;
# First send an email
--- 262,268 ----
sub task_no_default {
my ( $err ) = @_;
my $R = OpenInteract::Request->instance;
+ $err->{user_msg} = 'No default method defined';
+ $R->DEBUG && cluck ">> Error: Cannot do task due to no default: $err->{system_msg}";
# First send an email
***************
*** 278,283 ****
sub task_not_allowed_security {
my ( $err ) = @_;
- cluck ">> Error: Cannot accomplish task due to security." if ( DEBUG );
my $R = OpenInteract::Request->instance;
my $html = $R->template->handler( {},
{ err => $err,
--- 289,294 ----
sub task_not_allowed_security {
my ( $err ) = @_;
my $R = OpenInteract::Request->instance;
+ $R->DEBUG && cluck ">> Error: Cannot accomplish task due to security.";
my $html = $R->template->handler( {},
{ err => $err,
***************
*** 291,296 ****
sub cannot_retrieve_object_of_id {
my ( $err ) = @_;
- cluck ">> Error: Cannot retrieve object given a particular ID." if ( DEBUG );
my $R = OpenInteract::Request->instance;
# First send an email
--- 302,307 ----
sub cannot_retrieve_object_of_id {
my ( $err ) = @_;
my $R = OpenInteract::Request->instance;
+ $R->DEBUG && cluck ">> Error: Cannot retrieve object given a particular ID.";
# First send an email
***************
*** 334,339 ****
sub bad_username {
my ( $err ) = @_;
- 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;
--- 345,350 ----
sub bad_username {
my ( $err ) = @_;
my $R = OpenInteract::Request->instance;
+ $R->DEBUG && cluck ">> Error: User $err->{tmp_login_name} not found in system";
$R->{ $ERROR_HOLD }{loginbox}{bad_login} = "User $err->{tmp_login_name} not found!";
return undef;
***************
*** 342,347 ****
sub bad_password {
my ( $err ) = @_;
- 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};
--- 353,358 ----
sub bad_password {
my ( $err ) = @_;
my $R = OpenInteract::Request->instance;
+ $R->DEBUG && cluck ">> Error: User $err->{tmp_login_name} login with wrong password";
$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};
***************
*** 375,380 ****
sub log_and_return {
my ( $err, $opt ) = @_;
- cluck ">> Error with code $err->{code} thrown. Info: $err->{system_msg}" unless ( $opt eq 'nowarn' );
my $R = OpenInteract::Request->instance;
$R->DEBUG && $R->scrib( 2, "Trying to save errror ", Dumper( $err ) );
OpenInteract::Error::Main->save_error( $err );
--- 386,391 ----
sub log_and_return {
my ( $err, $opt ) = @_;
my $R = OpenInteract::Request->instance;
+ cluck ">> Error with code $err->{code} thrown. Info: $err->{system_msg}" unless ( $opt eq 'nowarn' );
$R->DEBUG && $R->scrib( 2, "Trying to save errror ", Dumper( $err ) );
OpenInteract::Error::Main->save_error( $err );
|