Skip to content
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
2 changes: 1 addition & 1 deletion terminusdb_client/client/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,7 @@ def pull(
if remote_branch is None:
remote_branch = self.branch
if author is None:
author = self.author
author = self._author
if message is None:
message = (
f"Pulling from {remote}/{remote_branch} by Python client {__version__}"
Expand Down
9 changes: 9 additions & 0 deletions terminusdb_client/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ def __init__(self, response=None):
response from the api call
"""
super().__init__()
if isinstance(response, dict):
self.error_obj = response
details = json.dumps(response, indent=4, sort_keys=True)
msg = response.get("api:message")
if not msg and isinstance(response.get("api:error"), dict):
msg = response["api:error"].get("vio:message")
self.message = (msg + "\n" if msg else "Unknown Error:\n") + details
self.status_code = None
return
if not response.text:
self.message = "Unknown Error - No error message from response."
elif (
Expand Down
7 changes: 4 additions & 3 deletions terminusdb_client/tests/integration_tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,10 @@ def test_has_doc(docker_url):
client.create_database(db_name, team="admin")
client.connect(db=db_name)
assert not client.has_doc("THIS_DOCUMENT_DOES_NOT_EXIST")
client.insert_document({"test": "test"}, raw_json=True)
doc_id = list(client.get_all_documents())[0]["@id"]
assert client.has_doc(doc_id)
client.insert_document(
{"@id": "test_document_has_doc", "test": "test"}, raw_json=True
)
assert client.has_doc("test_document_has_doc")


def test_get_organization_user_databases(docker_url):
Expand Down
Loading
Loading