t0021/rot13-filter: improve error message
authorChristian Couder <christian.couder@gmail.com>
Sun, 5 Nov 2017 21:38:32 +0000 (22:38 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 Nov 2017 00:54:41 +0000 (09:54 +0900)
If there is no new line at the end of something it receives,
the packet_txt_read() function die()s, but it's difficult to
debug without much context.

Let's give a bit more information when that happens.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0021/rot13-filter.pl
index 37cecd865495f89f7e84d468393564f46ea68523..f31ff595fedcd39c1420a002b4cb5957e5d190b6 100644 (file)
@@ -96,7 +96,8 @@ sub packet_bin_read {
 sub packet_txt_read {
        my ( $res, $buf ) = packet_bin_read();
        unless ( $res == -1 or $buf eq '' or $buf =~ s/\n$// ) {
-               die "A non-binary line MUST be terminated by an LF.";
+               die "A non-binary line MUST be terminated by an LF.\n"
+                   . "Received: '$buf'";
        }
        return ( $res, $buf );
 }