summaryrefslogtreecommitdiff
path: root/src/services/vyos-http-api-server
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2020-05-06 12:35:16 -0500
committerJohn Estabrook <jestabro@vyos.io>2020-05-06 19:12:32 -0500
commit25c65547458a3a2f4f4f8b1b70541229f3cbcc0c (patch)
treede1abe9cd13e11b21f3e2bf50c6a0601240f619f /src/services/vyos-http-api-server
parent3a24bd72f6eb10f5d38d053f0b234793865f6821 (diff)
downloadvyos-1x-25c65547458a3a2f4f4f8b1b70541229f3cbcc0c.tar.gz
vyos-1x-25c65547458a3a2f4f4f8b1b70541229f3cbcc0c.zip
http api: catch appropriate errors
Diffstat (limited to 'src/services/vyos-http-api-server')
-rwxr-xr-xsrc/services/vyos-http-api-server6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/services/vyos-http-api-server b/src/services/vyos-http-api-server
index 14cdd8437..4928b0bae 100755
--- a/src/services/vyos-http-api-server
+++ b/src/services/vyos-http-api-server
@@ -229,6 +229,8 @@ def retrieve_op():
return error(400, "\"{0}\" is not a valid operation".format(op))
except VyOSError as e:
return error(400, str(e))
+ except ConfigSessionError as e:
+ return error(400, str(e))
except Exception as e:
print(traceback.format_exc(), file=sys.stderr)
return error(500, "An internal error occured. Check the logs for details.")
@@ -264,7 +266,7 @@ def config_file_op():
res = session.commit()
else:
return error(400, "\"{0}\" is not a valid operation".format(op))
- except VyOSError as e:
+ except ConfigSessionError as e:
return error(400, str(e))
except Exception as e:
print(traceback.format_exc(), file=sys.stderr)
@@ -300,7 +302,7 @@ def image_op():
res = session.remove_image(name)
else:
return error(400, "\"{0}\" is not a valid operation".format(op))
- except VyOSError as e:
+ except ConfigSessionError as e:
return error(400, str(e))
except Exception as e:
print(traceback.format_exc(), file=sys.stderr)