2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-17 10:57:16 +00:00

catch crashes when no data has been imported

This commit is contained in:
Philip Sargent
2022-09-12 20:50:57 +03:00
parent 6452a7beed
commit 785845598f
2 changed files with 12 additions and 3 deletions

View File

@@ -515,8 +515,13 @@ def scanupload(request, path=None):
f = Path(settings.SURVEX_DATA) / svx
if f.is_file():
path = svx.parent / svx.stem
#print(f' - {path=}')
svxfile = SurvexFile.objects.get(path=path)
#print(f' - {path=}')
try:
svxfile = SurvexFile.objects.get(path=path)
except:
message = f'Specified survex file not found - database apparently empty, you probably need to do a full re-import of all data.'
return render(request, 'errors/generic.html', {'message': message})
print(f' - {svxfile=}')
caves.append(svxfile.cave)
caverefs.append(svxfile.cave.reference())