mirror of
https://github.com/langgenius/dify.git
synced 2026-11-11 05:41:09 +08:00
ci: enable Ruff SIM105 (#44112)
Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
1 parent
6a08c082a7
commit
1f3fdbc0d3
21 files changed
+47
-77
No files matched your search
@@ -20,6 +20,7 @@ The transport-generic enum members, ``_CODE_BY_STATUS`` and the
|
||||
promote them to ``libs`` if a second surface adopts ``ErrorBody``.
|
||||
"""
|
||||
|
||||
import contextlib
|
||||
import logging
|
||||
from enum import StrEnum
|
||||
from typing import Any
|
||||
@@ -170,10 +171,8 @@ class OpenApiErrorFormatter:
|
||||
# flask-restx Api.handle_error does `data = getattr(e, "data", default_data)`
|
||||
# AFTER our handler returns, so a pre-existing e.data (flask_restx.abort,
|
||||
# BaseHTTPException) would override the canonical body. Rewrite it.
|
||||
try:
|
||||
with contextlib.suppress(AttributeError):
|
||||
e.data = wire # type: ignore[attr-defined]
|
||||
except AttributeError:
|
||||
pass
|
||||
return wire
|
||||
|
||||
def _resolve_code(self, e: Exception, status_code: int) -> str:
|
||||
|
||||
Reference in new issue
Block a user