diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2022-07-23 20:05:58 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2022-07-23 20:05:58 +0300 |
commit | 5007393536bd23c19d16b41f9ef0806715ca111a (patch) | |
tree | 61d49565efa230048e681179e0e8f1390e088f7b /parsers/survex.py | |
parent | a1e538e93a03a9b46dc664e0d1ca8504f41ffd0d (diff) | |
download | troggle-5007393536bd23c19d16b41f9ef0806715ca111a.tar.gz troggle-5007393536bd23c19d16b41f9ef0806715ca111a.tar.bz2 troggle-5007393536bd23c19d16b41f9ef0806715ca111a.zip |
better error handling
Diffstat (limited to 'parsers/survex.py')
-rw-r--r-- | parsers/survex.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/parsers/survex.py b/parsers/survex.py index 4a5bba4..7b94005 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -202,7 +202,7 @@ class LoadingSurvex(): print(self.insp+message) DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path)) else: - message = "! Bad svx command: [*{}] {} ({}) {}".format(cmd, line, survexblock, survexblock.survexfile.path) + message = "! Bad unrecognised svx command: [*{}] {} ({}) {}".format(cmd, line, survexblock, survexblock.survexfile.path) print(self.insp+message) DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path)) @@ -313,7 +313,7 @@ class LoadingSurvex(): survexblock.date = datetime.strptime(line, '%Y') # sets to January 1st setdate(year) else: - message = "! DATE unrecognised '{}' ({}) {}".format(line, survexblock, survexblock.survexfile.path) + message = "! Error DATE unrecognised '{}' ({}) {}".format(line, survexblock, survexblock.survexfile.path) print(self.insp+message) DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path)) @@ -424,7 +424,7 @@ class LoadingSurvex(): except: message = ' ! Value Error: Compass not found in line %s in %s' % (ls, survexblock.survexfile.path) print(self.insp+message) - DataIssue.objects.create(parser='survexleg', message=message) + DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path)) lcompass = invalid_compass try: @@ -626,7 +626,7 @@ class LoadingSurvex(): # ls = ["normal", "from", "to", "tape", "compass", "clino" ] for i in range(1, len(ls)): # len[0] is "normal" if ls[i].lower() =="newline": - message = f" ! - ABORT *data statement has NEWLINE in it in {survexblock.survexfile.path}. Not parsed by torggle. '{args}'" + message = f" ! - ABORT *data statement has NEWLINE in it in {survexblock.survexfile.path}. Not parsed by troggle. '{args}'" print(message) print(message,file=sys.stderr) DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path)) @@ -735,7 +735,7 @@ class LoadingSurvex(): #print("\n"+message) #print("\n"+message,file=sys.stderr) return - message = f" ! Error: FAILURE '{headpath}' while creating '{includelabel}' at depth:'{depth}'. Not a cave or in the ignore list:'{self.ignoreprefix}'" + message = f" ! Error: FAILURE '{headpath}' while creating '{includelabel}' at depth:[{depth}]. Not a cave or in the ignore list:'{self.ignoreprefix}'" # getting this triggered for gpx/2018 (cavern error) but not for gpx/2017 (no content). print("\n"+message) print("\n"+message,file=sys.stderr) |