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

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



Revision: 5599
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5599&view=rev
Author:   einhverfr
Date:     2013-01-17 09:43:18 +0000 (Thu, 17 Jan 2013)
Log Message:
-----------
Correcting duplicate errors caused by die/catch/die blocks.

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Payment.pm
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB.pm
    trunk/lsmb-request.pl
    trunk/old-handler.pl

Modified: trunk/LedgerSMB/DBObject/Payment.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Payment.pm	2013-01-17 09:30:53 UTC (rev 5598)
+++ trunk/LedgerSMB/DBObject/Payment.pm	2013-01-17 09:43:18 UTC (rev 5599)
@@ -541,8 +541,7 @@
     my ($self) = @_;
     $self->get_metadata();
     if ( $self->{account_class} != 2 && !defined $self->{source_start} ){
-        $self->error('No source start defined!');
-        $self->finalize_request();
+        die 'No source start defined!';
     }
     #$self->error('No source start defined!') unless defined $self->{source_start}; 
 

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2013-01-17 09:30:53 UTC (rev 5598)
+++ trunk/LedgerSMB/Form.pm	2013-01-17 09:43:18 UTC (rev 5599)
@@ -438,6 +438,9 @@
 
 =item $form->error($msg);
 
+The function simply dies with message $msg however this is wrapped so that older
+behavior occurs, from the handler, see below for this older behavior. 
+
 Output an error message, $msg.  If a CGI environment is detected, this outputs
 an HTTP and HTML header section if required, and displays the message after
 running it through $form->format_string.  If it is not a CGI environment and
@@ -450,7 +453,12 @@
 =cut
 
 sub error {
+    my ( $self, $msg ) = @_;
+    die $msg;
+}
 
+sub error {
+
     my ( $self, $msg ) = @_;
 
     if ( $ENV{GATEWAY_INTERFACE} ) {

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2013-01-17 09:30:53 UTC (rev 5598)
+++ trunk/LedgerSMB.pm	2013-01-17 09:43:18 UTC (rev 5599)
@@ -810,7 +810,12 @@
 
 # To be replaced with a generic interface to an Error class
 sub error {
+    my ($self, $msg);
+    die $msg;
+}
 
+sub _error {
+
     my ( $self, $msg ) = @_;
     #Carp::confess();
     if ( $ENV{GATEWAY_INTERFACE} ) {

Modified: trunk/lsmb-request.pl
===================================================================
--- trunk/lsmb-request.pl	2013-01-17 09:30:53 UTC (rev 5598)
+++ trunk/lsmb-request.pl	2013-01-17 09:43:18 UTC (rev 5599)
@@ -116,7 +116,7 @@
       # -- CT
      $LedgerSMB::App_State::DBH->rollback if ($LedgerSMB::App_State::DBH and $_ eq 'Died');
      LedgerSMB::App_State->cleanup();
-     $request->error($_) unless $_ eq 'Died';
+     $request->_error($_) unless $_ eq 'Died';
   };
 }
 1;

Modified: trunk/old-handler.pl
===================================================================
--- trunk/old-handler.pl	2013-01-17 09:30:53 UTC (rev 5598)
+++ trunk/old-handler.pl	2013-01-17 09:43:18 UTC (rev 5599)
@@ -168,7 +168,7 @@
 
 if ($myconfig{language}){
     $locale   = LedgerSMB::Locale->get_handle( $myconfig{language} )
-      or $form->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
+      or $form->_error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
 }
 
 $LedgerSMB::App_State::Locale = $locale;

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