Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flux-account-update-db suppresses error from sqlite3.connect #248

Closed
grondo opened this issue Jul 13, 2022 · 0 comments · Fixed by #252
Closed

flux-account-update-db suppresses error from sqlite3.connect #248

grondo opened this issue Jul 13, 2022 · 0 comments · Fixed by #252
Assignees
Labels
improvement Upgrades to an already existing feature

Comments

@grondo
Copy link
Contributor

grondo commented Jul 13, 2022

If there is a problem connecting to the db in flux-account-update-db.py, the script prints a generic error:

Unable to open temporary database file: <file.db>

It would be useful to capture the exception thrown by sqlite and print the exception data, so that the real reason for the failure is printed to the user, e.g.

--- /usr/libexec/flux/cmd/flux-account-update-db.py	2022-06-23 09:40:44.000000000 -0700
+++ flux-account-update-db.py	2022-07-13 08:38:31.550533501 -0700
@@ -158,8 +158,8 @@
         new_conn.close()
 
         os.remove(new_db)
-    except sqlite3.OperationalError:
-        print(f"Unable to open temporary database file: %s" % new_db)
+    except sqlite3.OperationalError as exc:
+        print(f"Unable to open temporary database file: {new_db}: {exc}")
         sys.exit(1)
 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Upgrades to an already existing feature
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants