From: erickson Date: Fri, 9 Dec 2005 16:09:27 +0000 (+0000) Subject: for some reason, doing "throw $err $err->stringify" was causing a generic method X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6e47a4d5b141de482e0e21ab36ce700c636ff080;p=opensrf%2Fbjwebb.git for some reason, doing "throw $err $err->stringify" was causing a generic method exception to be thrown. Fixed by doing "throw $err". This should allow the /real/ error to be passed to the client, and not "method not found". Also cleaned up some other debugging info git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@608 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/perlmods/OpenSRF/Application.pm b/src/perlmods/OpenSRF/Application.pm index 418f2e6..99346c3 100644 --- a/src/perlmods/OpenSRF/Application.pm +++ b/src/perlmods/OpenSRF/Application.pm @@ -133,7 +133,9 @@ sub handler { my $resp; try { my $start = time(); + warn "About to run...\n"; $resp = $coderef->run( $appreq, @args); + warn "Done running...\n"; my $time = sprintf '%.3f', time() - $start; $log->debug( "Method duration for {$method_name}: ". $time, INFO ); if( defined( $resp ) ) { @@ -145,6 +147,8 @@ sub handler { } } catch Error with { my $e = shift; + warn "Caught error from 'run' method: $e\n"; + if(UNIVERSAL::isa($e,"Error")) { $e = $e->stringify(); } @@ -401,23 +405,19 @@ sub run { } catch Error with { my $e = shift; $err = $e; - warn "Caught Error in Application: $e\n"; - - if( UNIVERSAL::isa($e,"Error")) { - warn "Exception is:\n " . $e->stringify() . "\n"; - } + warn "Method 'run' catching error: $e\n"; if( ref($self) eq 'HASH') { - warn $self; $log->error("Sub $$self{package}::$$self{method} DIED!!!\n\t$e\n", ERROR); } }; if($err) { if(UNIVERSAL::isa($err,"Error")) { - throw $err ($err->stringify); + warn "Throwing from method run:\n$err\n------------------\n"; + throw $err; } else { - die $err; + die $err->stringify; } } diff --git a/src/perlmods/OpenSRF/DomainObject/oilsResponse.pm b/src/perlmods/OpenSRF/DomainObject/oilsResponse.pm index 6009032..673516b 100644 --- a/src/perlmods/OpenSRF/DomainObject/oilsResponse.pm +++ b/src/perlmods/OpenSRF/DomainObject/oilsResponse.pm @@ -405,8 +405,8 @@ B =cut -$status = 'Method not found'; -$statusCode = STATUS_NOTFOUND; +$status = 'A server error occured during method execution'; +$statusCode = STATUS_INTERNALSERVERERROR; # -------------------------------------------