From 131406774b250fcdd1c1a9c2dd7a4d0875150faa Mon Sep 17 00:00:00 2001 From: Ionut Filip Date: Mon, 25 Feb 2019 11:46:42 +0200 Subject: [PATCH] Handle setup subnet error --- setup/server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup/server.py b/setup/server.py index 4dfd49ae..0bb25a51 100644 --- a/setup/server.py +++ b/setup/server.py @@ -90,7 +90,10 @@ def build_app(path): def submit(): data = flask.request.form.copy() data['uid'] = str(uuid.uuid4()) - data['dns'] = str(ipaddress.IPv4Network(data['subnet'])[-2]) + try: + data['dns'] = str(ipaddress.IPv4Network(data['subnet'])[-2]) + except ValueError as err: + return "Error while generating files: " + str(err) db.set(data['uid'], json.dumps(data)) return flask.redirect(flask.url_for('.setup', uid=data['uid']))