t0021/rot13-filter: improve error message

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>
This commit is contained in:
Christian Couder 2017-11-05 22:38:32 +01:00 committed by Junio C Hamano
parent ed17d26245
commit 00df039faa

View 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 );
}