From: Ian Lynagh Date: Thu, 19 Aug 2010 23:24:20 +0000 (+0000) Subject: Give clearer errors for bad input in the packages file; suggested by pejo X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=d2b30a14b7b21ba17220cf14f3abd3868b5fa5d2 Give clearer errors for bad input in the packages file; suggested by pejo --- diff --git a/darcs-all b/darcs-all index 5ced5b7..b4ba47e 100644 --- a/darcs-all +++ b/darcs-all @@ -157,6 +157,7 @@ sub darcsall { my $tag; my @repos; my $command = $_[0]; + my $line; my ($repo_base, $checked_out_tree) = getrepo(); @@ -164,8 +165,10 @@ sub darcsall { @repos = ; close IN; + $line = 0; foreach (@repos) { chomp; + $line++; if (/^([^# ]+) +([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)$/) { $localpath = $1; $tag = $2; @@ -198,7 +201,7 @@ sub darcsall { } } elsif (! /^(#.*)?$/) { - die "Bad line: $_"; + die "Bad content on line $line of packages file: $_"; } } } @@ -210,6 +213,7 @@ sub darcsget { my $path; my $tag; my @repos; + my $line; my ($repo_base, $checked_out_tree) = getrepo(); @@ -225,8 +229,10 @@ sub darcsget { @repos = ; close IN; + $line = 0; foreach (@repos) { chomp; + $line++; if (/^([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)$/) { $localpath = $1; $tag = $2; @@ -249,7 +255,7 @@ sub darcsget { } } elsif (! /^(#.*)?$/) { - die "Bad line: $_"; + die "Bad content on line $line of packages file: $_"; } } }