]> git.sesse.net Git - remoteglot/commitdiff
Slightly more detailed PGN error messages.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 20 Jan 2016 22:35:52 +0000 (23:35 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 20 Jan 2016 22:35:52 +0000 (23:35 +0100)
remoteglot.pl

index c35a0518694789ad9c37452599226fd65977033a..82932387990ac2c960ec74d38d71fe1703a32577 100755 (executable)
@@ -275,8 +275,12 @@ sub handle_pgn {
        }
 
        my $pgn = Chess::PGN::Parse->new(undef, $body);
        }
 
        my $pgn = Chess::PGN::Parse->new(undef, $body);
-       if (!defined($pgn) || !$pgn->read_game() || $body !~ /^\[/) {
-               warn "Error in parsing PGN from $url\n";
+       if (!defined($pgn)) {
+               warn "Error in parsing PGN from $url [body='$body']\n";
+       } elsif (!$pgn->read_game()) {
+               warn "Error in reading PGN game from $url [body='$body']\n";
+       } elsif ($body !~ /^\[/) {
+               warn "Malformed PGN from $url [body='$body']\n";
        } else {
                eval {
                        # Skip to the right game.
        } else {
                eval {
                        # Skip to the right game.