Skip to content

Commit eacb4ea

Browse files
fix: improve BaseError __str__ to include full error context
1 parent 5dd5ce5 commit eacb4ea

3 files changed

Lines changed: 27 additions & 19 deletions

File tree

archipy/models/errors/base_error.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,15 @@ def __str__(self) -> str:
144144
Returns:
145145
str: A formatted string containing the error code and message.
146146
"""
147-
return f"[{self.code}] {self.get_message()}"
147+
return (
148+
f"{self.__class__.__name__}("
149+
f"code='{self.code}', "
150+
f"message='{self.get_message()}', "
151+
f"http_status={self.http_status}, "
152+
f"grpc_status={self.grpc_status}, "
153+
f"additional_data={self.additional_data}"
154+
f")"
155+
)
148156

149157
def __repr__(self) -> str:
150158
"""Detailed string representation of the exception.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ elastic-apm = ["elastic-apm>=6.25.0"]
2626
elasticsearch = ["elasticsearch>=9.3.0"]
2727
elasticsearch-async = ["elasticsearch[async]>=9.3.0"]
2828
fakeredis = ["fakeredis>=2.34.0"]
29-
fastapi = ["fastapi[all]>=0.131.0"]
29+
fastapi = ["fastapi[all]>=0.133.0"]
3030
grpc = ["grpcio>=1.78.1", "grpcio-health-checking>=1.78.1", "protobuf>=6.33.5"]
3131
jwt = ["pyjwt>=2.11.0"]
3232
kafka = ["confluent-kafka>=2.13.0"]
3333
kavenegar = ["kavenegar>=1.1.2"]
3434
keycloak = ["python-keycloak>=7.1.1", "cachetools>=7.0.1", "async-lru>=2.2.0"]
35-
minio = ["boto3>=1.42.54", "cachetools>=7.0.1", "async-lru>=2.2.0"]
35+
minio = ["boto3>=1.42.55", "cachetools>=7.0.1", "async-lru>=2.2.0"]
3636
parsian-ipg = ["zeep>=4.3.2", "requests[socks]>=2.32.5"]
3737
postgres = ["psycopg[binary,pool]>=3.3.3"]
3838
prometheus = ["prometheus-client>=0.24.1"]
@@ -83,7 +83,7 @@ dev = [
8383

8484
docs = [
8585
"mkdocs-autorefs>=1.4.4",
86-
"mkdocs-material>=9.7.2",
86+
"mkdocs-material>=9.7.3",
8787
"mkdocs>=1.6.1",
8888
"mkdocstrings-python>=2.0.3",
8989
"mkdocstrings>=1.0.3",

uv.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)