[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4345] trunk



Revision: 4345
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4345&view=rev
Author:   einhverfr
Date:     2012-02-23 01:48:44 +0000 (Thu, 23 Feb 2012)
Log Message:
-----------
Adding error handling exception for default exit

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject_Moose.pm
    trunk/lsmb-request.pl
    trunk/old-handler.pl

Modified: trunk/LedgerSMB/DBObject_Moose.pm
===================================================================
--- trunk/LedgerSMB/DBObject_Moose.pm	2012-02-23 01:32:19 UTC (rev 4344)
+++ trunk/LedgerSMB/DBObject_Moose.pm	2012-02-23 01:48:44 UTC (rev 4345)
@@ -145,9 +145,8 @@
         $self->{call_args} = ..hidden..;
         $logger->debug("exec_method: \$self = " . Data::Dumper::Dumper($self));
         for my $arg(@call_args){
-            if (isa('LedgerSMB::PGDate', $arg) or
-                 isa('LedgerSMB::PGNumber', $arg)){
-                $arg = $arg->to_db;
+            if (eval {$arg->can('to_db')}){
+               $arg = $arg->to_db;
             }
         }
            
@@ -159,9 +158,8 @@
     }
     else {
         for my $arg(@in_args){
-            if (isa('LedgerSMB::PGDate', $arg) or
-                 isa('LedgerSMB::PGNumber', $arg)){
-                $arg = $arg->to_db;
+            if (eval {$arg->can('to_db')}){
+               $arg = $arg->to_db;
             }
         }
            

Modified: trunk/lsmb-request.pl
===================================================================
--- trunk/lsmb-request.pl	2012-02-23 01:32:19 UTC (rev 4344)
+++ trunk/lsmb-request.pl	2012-02-23 01:48:44 UTC (rev 4345)
@@ -107,7 +107,11 @@
     $script->can( $request->{action} )->($request);
   }
   catch {
-     $request->error($_);
+      # We have an exception here because otherwise we always get an exception
+      # when output terminates.  A mere 'die' will no longer trigger an 
+      # automatic error, but die 'foo' will map to $request->error('foo')
+      # -- CT
+     $request->error($_) unless $_ eq 'Died';
   };
 }
 1;

Modified: trunk/old-handler.pl
===================================================================
--- trunk/old-handler.pl	2012-02-23 01:32:19 UTC (rev 4344)
+++ trunk/old-handler.pl	2012-02-23 01:48:44 UTC (rev 4345)
@@ -169,7 +169,11 @@
 
 }
 catch {
-  $form->error($_);
+  # We have an exception here because otherwise we always get an exception
+  # when output terminates.  A mere 'die' will no longer trigger an automatic
+  # error, but die 'foo' will map to $form->error('foo')
+  # -- CT
+  $form->error($_)  unless $_ eq 'Died'; 
 };
 
 $logger->trace("leaving after script=bin/$form->{script} action=$form->{action}");#trace flow

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.