Skip to content

Commit

Permalink
chore: remove custom error msg and log unknown error from sql runner
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmoysrt committed Oct 18, 2024
1 parent f255605 commit b2c166c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions agent/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ def execute_query(self, query: str, commit: bool = False, as_dict: bool = False)
try:
return True, self._sql(query, commit=commit, as_dict=as_dict)
except (ProgrammingError, InternalError) as e:
return False, "Error while executing query: " + str(e)
except Exception:
return False, "Failed to execute query. Please check the query and try again later."
return False, str(e)
except Exception as e:
print(f"Error executing SQL Query on {self.database} : {e}")
return (
False,
"Failed to execute query due to unknown error. Please check the query and try again later.",
)

# Private helper methods
def _sql(self, query: str, params=(), commit: bool = False, as_dict: bool = False) -> dict | None:
Expand Down

0 comments on commit b2c166c

Please sign in to comment.