client exception: try to avoid HTTP code duplication in error string

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-12-03 15:55:53 +01:00
parent 9518a97873
commit 50f793b9d1

View File

@ -99,8 +99,13 @@ sub raise_param_exc {
sub stringify {
my $self = shift;
my $msg = $self->{code} ? "$self->{code} $self->{msg}" : $self->{msg};
my $msg = $self->{msg};
if (my $code = $self->{code}) {
if ($msg !~ /^\s*\Q$code\E[\s:,]/) { # avoid duplicating the error code heuristically
$msg = "$code $msg";
}
}
if ($msg !~ m/\n$/) {