On Tue, Apr 2, 2013 at 2:44 PM, Guido Trotter <[email protected]> wrote:
> Before:
> $ ./autotools/check-news < ./NEWS
> Traceback (most recent call last):
>   File "./autotools/check-news", line 150, in <module>
>     main()
>   File "./autotools/check-news", line 120, in main
>     parsed_ts = time.mktime(time.strptime(m.group("date"), "%d %b %Y"))
> AttributeError: 'NoneType' object has no attribute 'group'
>
> After:
> $ ./autotools/check-news < ./NEWS
> Line 8: Invalid release line
>
> This happened because the error function just updates an error log,
> rather than bailing out immediately.
>
> Signed-off-by: Guido Trotter <[email protected]>
> ---
>  autotools/check-news |    1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/autotools/check-news b/autotools/check-news
> index 146faf2..fd28b5d 100755
> --- a/autotools/check-news
> +++ b/autotools/check-news
> @@ -113,6 +113,7 @@ def main():
>        m = RELEASED_RE.match(line)
>        if not m:
>          Error("Line %s: Invalid release line" % fileinput.filelineno())
> +        break

Alternatively:
expect_date = False
continue

So that the error is considered and further errors can be checked as well.

Thanks,

Guido

Reply via email to