Skip to content

Fix Error Handling Redundancy in postgres_connector.py #279

@hollowtree11

Description

@hollowtree11

The redundancy in postgres_connector.py is the try/catch/except blocks that come up in nearly the same structure in every function as follows:
try:
with self.connection.cursor() as cur:
cur.execute(sql, (function_id,))
result = cur.fetchall()
except Exception:
self.connection.rollback()
result = None
finally:
if cur:
cur.close()
To handle this, we should create a try_query function that takes an SQL statement and handles the execution of the statement and error handling within it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions