forked from expo/troggle
let exceptions bubble up
This commit is contained in:
@@ -39,7 +39,9 @@ todo='''- Move utility function into utils.py
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def writetrogglefile(filepath, filecontent):
|
def writetrogglefile(filepath, filecontent):
|
||||||
'''Set permissions to rw-rw-r-- and commit the new saved file to git'''
|
'''Set permissions to rw-rw-r-- and commit the new saved file to git
|
||||||
|
Callers should handle exception PermissionsError explicitly
|
||||||
|
'''
|
||||||
filepath = Path(filepath)
|
filepath = Path(filepath)
|
||||||
cwd = filepath.parent
|
cwd = filepath.parent
|
||||||
filename = filepath.name
|
filename = filepath.name
|
||||||
|
|||||||
@@ -359,14 +359,16 @@ def edit_cave(request, slug=None):
|
|||||||
for ceinst in ceinsts:
|
for ceinst in ceinsts:
|
||||||
ceinst.cave = cave
|
ceinst.cave = cave
|
||||||
ceinst.save()
|
ceinst.save()
|
||||||
try:
|
cave.writeDataFile()
|
||||||
cave.writeDataFile()
|
# try:
|
||||||
except PermissionError:
|
# cave.writeDataFile()
|
||||||
message = f'CANNOT save this file.\nPERMISSIONS incorrectly set on server for this file {cave.filename}. Ask a nerd to fix this.'
|
# except PermissionError:
|
||||||
return render(request,'errors/generic.html', {'message': message})
|
# message = f'CANNOT save this file.\nPERMISSIONS incorrectly set on server for this file {cave.filename}. Ask a nerd to fix this.'
|
||||||
except:
|
# return render(request,'errors/generic.html', {'message': message})
|
||||||
message = f'CANNOT git on server for this file {cave.filename}. Edits not saved.\nAsk a nerd to fix this.'
|
# leave other exeptions unhandled so that they bubble up to userinterface
|
||||||
return render(request,'errors/generic.html', {'message': message})
|
# except:
|
||||||
|
# message = f'CANNOT git on server for this file {cave.filename}. Edits not saved.\nAsk a nerd to fix this.'
|
||||||
|
# return render(request,'errors/generic.html', {'message': message})
|
||||||
|
|
||||||
return HttpResponseRedirect("/" + cave.url)
|
return HttpResponseRedirect("/" + cave.url)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user