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

SF.net SVN: ledger-smb:[6627] trunk/LedgerSMB/Template.pm



Revision: 6627
          http://sourceforge.net/p/ledger-smb/code/6627
Author:   einhverfr
Date:     2014-01-25 06:29:58 +0000 (Sat, 25 Jan 2014)
Log Message:
-----------
Removing old error handling from Template.pm, changing to die commands

Modified Paths:
--------------
    trunk/LedgerSMB/Template.pm

Modified: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm	2014-01-25 06:27:14 UTC (rev 6626)
+++ trunk/LedgerSMB/Template.pm	2014-01-25 06:29:58 UTC (rev 6627)
@@ -153,7 +153,6 @@
 use strict;
 use Carp;
 
-use Error qw(:try);
 use LedgerSMB::Sysconfig;
 use LedgerSMB::Mailer;
 use LedgerSMB::Company_Config;
@@ -228,14 +227,14 @@
 	bless $self, $class;
 
 	if ($self->{format} !~ /^\p{IsAlnum}+$/) {
-		throw Error::Simple "Invalid format";
+		die "Invalid format";
 	}
 	if (!$self->{include_path}){
 		$self->{include_path} = $self->{'myconfig'}->{'templates'};
 		$self->{include_path} ||= 'templates/demo';
 		if (defined $self->{language}){
 			if (!$self->_valid_language){
-				throw Error::Simple 'Invalid language';
+				die 'Invalid language';
 				return undef;
 			}
 			$self->{include_path_lang} = "$self->{'include_path'}"
@@ -311,7 +310,7 @@
         }
 
 	if ($self->{format} !~ /^\p{IsAlnum}+$/) {
-		throw Error::Simple "Invalid format";
+		die "Invalid format";
 	}
 	my $format = "LedgerSMB::Template::$self->{format}";
 
@@ -320,7 +319,7 @@
 #	}
 	eval "require $format";
 	if ($@) {
-		throw Error::Simple $@;
+		die $@;
 	}
 
 	my $cleanvars;
@@ -409,7 +408,7 @@
 	$data ||= $self->{output};
         
 	if ($self->{format} !~ /^\p{IsAlnum}+$/) {
-		throw Error::Simple "Invalid format";
+		die "Invalid format";
 	}
 	if (!defined $data and defined $self->{rendered}){
 		$data = "";
@@ -420,7 +419,7 @@
 			$data .= $line;
 		}
                 $logger->trace("end DATA < self->{rendered}");
-	        unlink($self->{rendered}) or throw Error::Simple 'Unable to delete output file';
+	        unlink($self->{rendered}) or die 'Unable to delete output file';
 	}
 
 	my $format = "LedgerSMB::Template::$self->{format}";
@@ -453,7 +452,7 @@
 	my $FH;
 
 	open($FH, '<:bytes', $self->{rendered}) or
-		throw Error::Simple 'Unable to open rendered file';
+		die 'Unable to open rendered file';
 	my $data;
 	{
 		local $/;
@@ -464,7 +463,7 @@
 	$self->_http_output($data);
 	
 	unlink($self->{rendered}) or
-		throw Error::Simple 'Unable to delete output file';
+		die 'Unable to delete output file';
 }
 
 sub _email_output {
@@ -522,7 +521,7 @@
 	my ($self, $in_args) = shift;
 	my $args = $self->{output_args};
 	if ($self->{format} ne 'LaTeX') {
-		throw Error::Simple "Invalid Format";
+		die "Invalid Format";
 	}
 	my $lpr = $LedgerSMB::Sysconfig::printer{$args->{media}};
 

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


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits