]> dxcluster.net Git - spider.git/commitdiff
add better errors in DXUser::Exportusers
authorDirk Koopman <djk@tobit.co.uk>
Mon, 8 Jun 2020 16:40:17 +0000 (17:40 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Mon, 8 Jun 2020 16:40:17 +0000 (17:40 +0100)
perl/DXUser.pm

index 454432d190ca368523e4f8b37ae69790c1220a18..f78c8120181bfd39889e4be48a7b90ca60c4e9c6 100644 (file)
@@ -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;