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

Handle session exceptions using a context manager #399

Open
sssoleileraaa opened this issue Jun 4, 2019 · 2 comments
Open

Handle session exceptions using a context manager #399

sssoleileraaa opened this issue Jun 4, 2019 · 2 comments

Comments

@sssoleileraaa
Copy link
Contributor

Description

Handle sqlalchemy exceptions when performing database operations.

A context manager can be used to help: 4a9bd13#diff-0438bcd9fa8b6dd6a25960faa06c1452R14

@redshiftzero
Copy link
Contributor

👍 and we could make this context manager a ContextDecorator so that we can just add the decorator to the functions in storage.py for it to use a new session and the generic exception handling (because flat is better than nested and the diff is way smaller).

@eloquence eloquence changed the title Handle session exceptions Handle session exceptions using a context manager Aug 15, 2022
@eloquence
Copy link
Member

From 2022-08-15 review with @gonzalo-bulnes @eloquence:

  • Since this issue was filed, some manual exception handling has been introduced.
  • The suggestion to use a context manager for more consistent error handling still seems relevant, keeping open and nominating for summer cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants