for some reason, doing "throw $err $err->stringify" was causing a generic method
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 9 Dec 2005 16:09:27 +0000 (16:09 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 9 Dec 2005 16:09:27 +0000 (16:09 +0000)
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

src/perlmods/OpenSRF/Application.pm
src/perlmods/OpenSRF/DomainObject/oilsResponse.pm

index 418f2e6..99346c3 100644 (file)
@@ -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
                        }
                }
 
index 6009032..673516b 100644 (file)
@@ -405,8 +405,8 @@ B<OpenSRF::DomainObject::oilsException>
 =cut
 
 
-$status = 'Method not found';
-$statusCode = STATUS_NOTFOUND;
+$status = 'A server error occured during method execution';
+$statusCode = STATUS_INTERNALSERVERERROR;
 
 # -------------------------------------------