From 100779a7b7f71749b10fe078b8f38307319ef88f Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Thu, 30 Aug 2007 17:52:49 +0000 Subject: Properly clean up errors from exceptions. Properly catch exceptions when creating ACL objects in Wallet::Server. Don't return the ACL object from the acl_create method of Wallet::Server -- it's a layering violation. --- perl/Wallet/Object/Base.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'perl/Wallet/Object') diff --git a/perl/Wallet/Object/Base.pm b/perl/Wallet/Object/Base.pm index 389bbef..bc4bc26 100644 --- a/perl/Wallet/Object/Base.pm +++ b/perl/Wallet/Object/Base.pm @@ -143,7 +143,7 @@ sub log_action { my $id = $self->{type} . ':' . $self->{name}; $self->{error} = "cannot update history for $id: $@"; chomp $self->{error}; - $self->{error} =~ / at .*$/; + $self->{error} =~ s/ at .*$//; $self->{dbh}->rollback; return undef; } @@ -238,7 +238,7 @@ sub owner { if ($@) { $self->{error} = $@; chomp $self->{error}; - $self->{error} =~ / at .*$/; + $self->{error} =~ s/ at .*$//; return undef; } return $self->_set_internal ('owner', $acl->id, $user, $host, $time); @@ -254,7 +254,7 @@ sub acl { if ($type !~ /^(get|store|show|destroy|flags)\z/) { $self->{error} = "invalid ACL type $type"; chomp $self->{error}; - $self->{error} =~ / at .*$/; + $self->{error} =~ s/ at .*$//; return; } my $attr = "acl_$type"; @@ -264,7 +264,7 @@ sub acl { if ($@) { $self->{error} = $@; chomp $self->{error}; - $self->{error} =~ / at .*$/; + $self->{error} =~ s/ at .*$//; return undef; } return $self->_set_internal ($attr, $acl->id, $user, $host, $time); @@ -340,7 +340,7 @@ sub show { if ($@) { $self->{error} = "cannot retrieve data for ${type}:${name}: $@"; chomp $self->{error}; - $self->{error} =~ / at .*$/; + $self->{error} =~ s/ at .*$//; return undef; } my $output = ''; @@ -378,7 +378,7 @@ sub destroy { if ($@) { $self->{error} = "cannot destroy ${type}:${name}: $@"; chomp $self->{error}; - $self->{error} =~ / at .*$/; + $self->{error} =~ s/ at .*$//; $self->{dbh}->rollback; return undef; } -- cgit v1.2.3