From 5cf90be453f7833f10a0ec31dab28fd4d7e63f9a Mon Sep 17 00:00:00 2001 From: Akseli Lukkarila Date: Wed, 30 Oct 2024 14:23:33 +0200 Subject: [PATCH] nicer error handling for python vault --- python-pyo3/python/p_vault/vault.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/python-pyo3/python/p_vault/vault.py b/python-pyo3/python/p_vault/vault.py index abfba062..493bd130 100644 --- a/python-pyo3/python/p_vault/vault.py +++ b/python-pyo3/python/p_vault/vault.py @@ -4,9 +4,15 @@ def main(): - # Override the script name in the arguments list so the Rust CLI works correctly - args = ["pvault"] + sys.argv[1:] - nitor_vault_rs.run(args) + try: + # Override the script name in the arguments list so the Rust CLI works correctly + args = ["pvault"] + sys.argv[1:] + nitor_vault_rs.run(args) + except KeyboardInterrupt: + print("\naborted") + exit(1) + except Exception as e: + print(f"Error: {e}") if __name__ == "__main__":