From 7e1e63cd09897693050c2b64013e32127b20a793 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 28 Feb 2017 14:31:52 +0100 Subject: [PATCH] Catch error when we can't save the settings Fix #921 --- gns3server/handlers/api/controller/server_handler.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gns3server/handlers/api/controller/server_handler.py b/gns3server/handlers/api/controller/server_handler.py index b66f2e83..f6551550 100644 --- a/gns3server/handlers/api/controller/server_handler.py +++ b/gns3server/handlers/api/controller/server_handler.py @@ -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)