Skip to content

feat: pgvector - make error messages more informative #1684

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

Merged
merged 3 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ GitHub. The GitHub Actions workflow will take care of the rest.
```
3. Wait for the CI to do its magic
4. Review the changelog PR

If the release is successful, the HaystackBot will open a pull request to generate the changelog.
Add yourself as the reviewer. If there are any issues, edit the changelog manually.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ def _execute_sql(
result = cursor.execute(sql_query, params)
except Error as e:
self._connection.rollback()
detailed_error_msg = f"{error_msg}.\nYou can find the SQL query and the parameters in the debug logs."
detailed_error_msg = (
f"{error_msg}. Error: {e!r}. \nYou can find the SQL query and the parameters in the debug logs."
)
raise DocumentStoreError(detailed_error_msg) from e

return result
Expand Down Expand Up @@ -314,7 +316,9 @@ async def _execute_sql_async(
result = await cursor.execute(sql_query, params)
except Error as e:
await self._async_connection.rollback()
detailed_error_msg = f"{error_msg}.\nYou can find the SQL query and the parameters in the debug logs."
detailed_error_msg = (
f"{error_msg}. Error: {e!r}. \nYou can find the SQL query and the parameters in the debug logs."
)
raise DocumentStoreError(detailed_error_msg) from e

return result
Expand Down Expand Up @@ -795,7 +799,7 @@ def write_documents(self, documents: List[Document], policy: DuplicatePolicy = D
except Error as e:
self._connection.rollback()
error_msg = (
"Could not write documents to PgvectorDocumentStore. \n"
f"Could not write documents to PgvectorDocumentStore. Error: {e!r}. \n"
"You can find the SQL query and the parameters in the debug logs."
)
raise DocumentStoreError(error_msg) from e
Expand Down Expand Up @@ -852,7 +856,7 @@ async def write_documents_async(
except Error as e:
await self._async_connection.rollback()
error_msg = (
"Could not write documents to PgvectorDocumentStore. \n"
f"Could not write documents to PgvectorDocumentStore. Error: {e!r}. \n"
"You can find the SQL query and the parameters in the debug logs."
)
raise DocumentStoreError(error_msg) from e
Expand Down