[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
cd50f9e51d
commit
18673a562a
682 changed files with 25903 additions and 8390 deletions
|
|
@ -148,7 +148,9 @@ def error_body_for_path(
|
|||
"""
|
||||
if is_anthropic_path(path):
|
||||
return anthropic_error_body(message, status = status, err_type = err_type)
|
||||
return openai_error_body(message, status = status, err_type = err_type, code = code, param = param)
|
||||
return openai_error_body(
|
||||
message, status = status, err_type = err_type, code = code, param = param
|
||||
)
|
||||
|
||||
|
||||
def _summarize_validation_errors(errors) -> tuple:
|
||||
|
|
@ -181,7 +183,11 @@ def _summarize_validation_errors(errors) -> tuple:
|
|||
param = part
|
||||
break
|
||||
|
||||
label = ".".join(str(p) for p in loc_parts) if loc_parts else ".".join(str(p) for p in loc)
|
||||
label = (
|
||||
".".join(str(p) for p in loc_parts)
|
||||
if loc_parts
|
||||
else ".".join(str(p) for p in loc)
|
||||
)
|
||||
summary = f"{label}: {msg}" if label else str(msg)
|
||||
return summary, param
|
||||
|
||||
|
|
@ -221,7 +227,9 @@ def install_api_error_handlers(app) -> None:
|
|||
if wants_api_error_envelope(path):
|
||||
detail = exc.detail
|
||||
# Already a fully-formed envelope: pass through untouched.
|
||||
if isinstance(detail, dict) and ("error" in detail or detail.get("type") == "error"):
|
||||
if isinstance(detail, dict) and (
|
||||
"error" in detail or detail.get("type") == "error"
|
||||
):
|
||||
return JSONResponse(
|
||||
status_code = exc.status_code,
|
||||
content = detail,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue