Skip to content

Commit

Permalink
Use $db->errstr instead of not necessarily set $@ to get error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jonjensen committed Nov 2, 2017
1 parent d65c8c0 commit 7881890
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/lib/UI/pages/admin/pref_select.html
Expand Up @@ -78,7 +78,7 @@

for(grep $_, @{$CGI_array->{item_id}}) {
$db->delete_record($_)
or push @errors, $@;
or push @errors, $db->errstr;
}
if(@errors) {
my $plural = @errors > 1 ? 's' : '';
Expand Down
8 changes: 4 additions & 4 deletions dist/lib/UI/profiles/db_maintenance
Expand Up @@ -143,18 +143,18 @@ __NAME__ db_maintenance
push @out, errmsg("Deleted %s from %s", $key, $t);
}
else {
push @errors, errmsg("Unable to delete %s: %s", $key, $@);
push @errors, errmsg("Unable to delete %s: %s", $key, $db->errstr);
}
}
else {
for(@{$CGI_array->{$idp}}) {
#Debug("simple case regular key=$_");
my $rc = $db->delete_record($_);
if($rc) {
push @out, errmsg("Deleted %s from %s", $_, $t);
push @out, errmsg("Deleted %s from %s", $_, $t);
}
else {
push @errors, errmsg("Unable to delete %s from %s: %s", $_, $t, $@);
push @errors, errmsg("Unable to delete %s from %s: %s", $_, $t, $db->errstr);
}
}
}
Expand Down Expand Up @@ -202,7 +202,7 @@ __NAME__ db_maintenance
next unless $db->record_exists($key);
$db->delete_record($key)
or do {
push @errors, $@;
push @errors, $db->errstr;
next;
};
push @out, errmsg("Deleted %s from %s", $key, $t);
Expand Down

0 comments on commit 7881890

Please sign in to comment.