From: Dirk Koopman Date: Mon, 8 Jun 2020 16:40:17 +0000 (+0100) Subject: add better errors in DXUser::Exportusers X-Git-Url: http://scm.dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=fa27020ac9e6e3e8b64a2e82351eb00487b04bfb;p=spider.git add better errors in DXUser::Exportusers --- diff --git a/perl/DXUser.pm b/perl/DXUser.pm index 454432d1..f78c8120 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -323,9 +323,15 @@ sub encode { my $ref = shift; unbless($ref); - my $s = $json->encode($ref); - bless $ref, 'DXUser'; - return $s; + my $s; + + eval {$s = $json->encode($ref) }; + if ($s && !$@) { + bless $ref, 'DXUser'; + return $s; + } else { + LogDbg('DXUser', "DXUser::json_encode $ref->{call}, $@"); + } } @@ -482,9 +488,9 @@ print "There are $count user records and $err errors in $diff mS\n"; my $ekey = $key; $eval =~ s/([\%\x00-\x1f\x7f-\xff])/sprintf("%%%02X", ord($1))/eg; $ekey =~ s/([\%\x00-\x1f\x7f-\xff])/sprintf("%%%02X", ord($1))/eg; - LogDbg('DXCommand', "Export Error1: $ekey\t$eval"); + LogDbg('DXCommand', "Export Error1: invalid callsign($ekey) => '$eval'"); eval {$dbm->del($key)}; - dbg(carp("Export Error1: $ekey\t$eval\n$@")) if $@; + dbg(carp("Export Error1: delete call $ekey => '$eval' $@")) if $@; ++$err; next; } @@ -495,7 +501,7 @@ print "There are $count user records and $err errors in $diff mS\n"; if ($ref->is_user && !$ref->{priv} && $main::systime > $t + $tooold) { unless ($ref->{lat} && $ref->{long} || $ref->{qth} || $ref->{qra}) { eval {$dbm->del($key)}; - dbg(carp("Export Error2: $key\t$val\n$@")) if $@; + dbg(carp("Export Error2: delete $key => '$val' $@")) if $@; LogDbg('DXCommand', "$ref->{call} deleted, too old"); $del++; next;