summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-18 22:03:25 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-18 22:03:25 +0000
commitaef6c97fadab8fc3469d56a8f9fba6dae4510f45 (patch)
tree661bca517a157f6b9fa09a8262d6fe60c13167ac
parenta5563154d13467c169eadb7858d15694133a2b2a (diff)
LedgerSMB::error() to be replaced by a simple interface to an error class
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1210 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB.pm31
1 files changed, 31 insertions, 0 deletions
diff --git a/LedgerSMB.pm b/LedgerSMB.pm
index 2cfee9c6..7f6b4335 100755
--- a/LedgerSMB.pm
+++ b/LedgerSMB.pm
@@ -521,6 +521,37 @@ sub date_to_number {
$date;
}
+# To be replaced with a generic interface to an Error class
+sub error {
+
+ my ( $self, $msg ) = @_;
+
+ if ( $ENV{GATEWAY_INTERFACE} ) {
+
+ $self->{msg} = $msg;
+ $self->{format} = "html";
+ $self->format_string('msg');
+
+ delete $self->{pre};
+
+ if ( !$self->{header} ) {
+ $self->header;
+ }
+
+ print
+ qq|<body><h2 class="error">Error!</h2> <p><b>$self->{msg}</b></body>|;
+
+ exit;
+
+ }
+ else {
+
+ if ( $ENV{error_function} ) {
+ &{ $ENV{error_function} }($msg);
+ }
+ die "Error: $msg\n";
+ }
+}
# Database routines used throughout
sub db_init {