Skip to content
Merged
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
7 changes: 4 additions & 3 deletions src/openai/_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import httpx

from ._utils import is_dict
from ._models import construct_type

__all__ = [
"BadRequestError",
Expand Down Expand Up @@ -51,9 +52,9 @@ def __init__(self, message: str, request: httpx.Request, *, body: object | None)
self.body = body

if is_dict(body):
self.code = cast(Any, body.get("code"))
self.param = cast(Any, body.get("param"))
self.type = cast(Any, body.get("type"))
self.code = cast(Any, construct_type(type_=Optional[str], value=body.get("code")))
self.param = cast(Any, construct_type(type_=Optional[str], value=body.get("param")))
self.type = cast(Any, construct_type(type_=str, value=body.get("type")))
else:
self.code = None
self.param = None
Expand Down