Catch error when we can't save the settings

Fix #921
This commit is contained in:
Julien Duponchelle 2017-02-28 14:31:52 +01:00
parent 39106ac36b
commit 7e1e63cd09
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -114,7 +114,10 @@ class ServerHandler:
def write_settings(request, response):
controller = Controller.instance()
controller.settings = request.json
controller.save()
try:
controller.save()
except (OSError, PermissionError) as e:
raise HTTPConflict(text="Can't save the settings {}".format(str(e)))
response.json(controller.settings)
response.set_status(201)