Skip to content

Commit 05f9168

Browse files
Addressing Simon's feedback
1 parent 2a64ac2 commit 05f9168

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

aws_lambda_powertools/event_handler/openapi/encoders.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pydantic.types import SecretBytes, SecretStr
1515

1616
from aws_lambda_powertools.event_handler.openapi.compat import _model_dump
17-
from aws_lambda_powertools.event_handler.openapi.exceptions import EncoderError
17+
from aws_lambda_powertools.event_handler.openapi.exceptions import SerializationError
1818
from aws_lambda_powertools.event_handler.openapi.types import IncEx
1919

2020
"""
@@ -154,7 +154,7 @@ def jsonable_encoder( # noqa: PLR0911
154154
exclude_defaults=exclude_defaults,
155155
)
156156
except ValueError as exc:
157-
raise EncoderError(
157+
raise SerializationError(
158158
f"Unable to serializer the object {obj} as it is not a supported type. Error details: {str(exc)}",
159159
"See: https://docs.powertools.aws.dev/lambda/python/latest/core/event_handler/api_gateway/#serializing-objects",
160160
) from exc

aws_lambda_powertools/event_handler/openapi/exceptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(self, errors: Sequence[Any], *, body: Any = None) -> None:
2323
self.body = body
2424

2525

26-
class EncoderError(Exception):
26+
class SerializationError(Exception):
2727
"""
2828
Base exception for all encoding errors
2929
"""

tests/functional/event_handler/test_openapi_encoders.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from pydantic.color import Color
88

99
from aws_lambda_powertools.event_handler.openapi.encoders import jsonable_encoder
10-
from aws_lambda_powertools.event_handler.openapi.exceptions import EncoderError
10+
from aws_lambda_powertools.event_handler.openapi.exceptions import SerializationError
1111

1212

1313
def test_openapi_encode_include():
@@ -191,5 +191,5 @@ def test_openapi_encode_with_error():
191191
class MyClass:
192192
__slots__ = []
193193

194-
with pytest.raises(EncoderError, match="Unable to serializer the object*"):
194+
with pytest.raises(SerializationError, match="Unable to serializer the object*"):
195195
jsonable_encoder(MyClass())

0 commit comments

Comments
 (0)