From 0dcdabe339754c52cb6d825c283efcdd2b2666e1 Mon Sep 17 00:00:00 2001 From: bretello Date: Sat, 15 Jun 2024 18:26:45 +0200 Subject: [PATCH] fix error handling (errors were returning 500) --- app.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 21b5251..c2300f1 100755 --- a/app.py +++ b/app.py @@ -33,10 +33,9 @@ def post_index(): try: ldap_change_password(form('username'), form('old-password'), form('new-password')) - except Error as e: - print("Unsuccessful attemp to change password for {}: {}" - .format(form('username'), str(e))) - return error(str(e)) + except Exception as exc: + print(f"Unsuccessful attempt to change password for {form('username')}: {exc=}") + return error(str(exc)) print("Password successfully changed for: {}" .format(form('username')))