From 1340bbed021a24d43c3b388709126f1c83fb9cc0 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Tue, 17 Nov 2015 14:28:27 +0100 Subject: [PATCH] Include line number only if relevant --- patacrep/songs/errors.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/patacrep/songs/errors.py b/patacrep/songs/errors.py index 94aff3ed..ac15c2b8 100644 --- a/patacrep/songs/errors.py +++ b/patacrep/songs/errors.py @@ -24,7 +24,10 @@ class SongSyntaxError(SongError): self.line = line def __str__(self): - return "Line {}: {}".format(self.line, self.message) + if self.line is not None: + return "Line {}: {}".format(self.line, self.message) + else: + return self.message # class FileError(SongError): # type = "file"