[PATCH 3/6] t0021/rot13-filter: improve error message
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Oct 19, 2017, 12:30 UTC
- Message-ID
- <20171019123030.17338-4-chriscool@tuxfamily.org>
- In-Reply-To
- <20171019123030.17338-1-chriscool@tuxfamily.org>
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> --- t/t0021/rot13-filter.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/t0021/rot13-filter.pl b/t/t0021/rot13-filter.pl index 82882392ae..3b3da8a03d 100644 --- a/t/t0021/rot13-filter.pl +++ b/t/t0021/rot13-filter.pl @@ -82,7 +82,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 ); }
-- 2.15.0.rc1.106.g7e97f58a41