dify/api/services/errors
GareArc 2b739b9544
fix: handle enterprise API errors properly to prevent KeyError crashes
When enterprise API returns 403/404, the response contains error JSON
instead of expected data structure. Code was accessing fields directly
causing KeyError → 500 Internal Server Error.

Changes:
- Add enterprise-specific error classes (EnterpriseAPIError, etc.)
- Implement centralized error validation in EnterpriseRequest.send_request()
- Extract error messages from API responses (message/error/detail fields)
- Raise domain-specific errors based on HTTP status codes
- Preserve backward compatibility with raise_for_status parameter

This prevents KeyError crashes and returns proper HTTP error codes
(403/404) instead of 500 errors.
2026-03-04 19:53:43 -08:00
..
__init__.py fix: handle enterprise API errors properly to prevent KeyError crashes 2026-03-04 19:53:43 -08:00
account.py fix: delete some dead code using vulture (#20999) 2025-06-16 12:07:41 +08:00
app_model_config.py feat: add multi model credentials (#24451) 2025-08-25 16:12:29 +08:00
app.py fix: consolidate duplicate InvokeRateLimitError definitions (#30229) 2025-12-28 03:03:42 +09:00
audio.py tts add voice choose (#2391) 2024-02-15 22:41:18 +08:00
base.py chore: add ast-grep rule to convert Optional[T] to T | None (#25560) 2025-09-15 13:06:33 +08:00
chunk.py Feat/support parent child chunk (#12092) 2024-12-25 19:49:07 +08:00
conversation.py [Enhancement] Allow modify conversation variable via api (#23112) 2025-08-01 09:34:56 +08:00
dataset.py refactor: Delete the dataset to verify whether it is in use (#5112) 2024-06-14 03:25:38 +08:00
document.py Initial commit 2023-05-15 08:51:32 +08:00
enterprise.py fix: handle enterprise API errors properly to prevent KeyError crashes 2026-03-04 19:53:43 -08:00
file.py feat: implement file extension blacklist for upload security (#27540) 2025-11-04 15:45:22 +08:00
index.py Initial commit 2023-05-15 08:51:32 +08:00
llm.py chore: add ast-grep rule to convert Optional[T] to T | None (#25560) 2025-09-15 13:06:33 +08:00
message.py Initial commit 2023-05-15 08:51:32 +08:00
plugin.py Feat/plugin install scope management (#19963) 2025-06-18 16:25:00 +08:00
workflow_service.py feat(workflow_service): workflow version control api. (#14860) 2025-03-10 13:34:31 +08:00
workspace.py E-300 (#19726) 2025-05-20 12:07:50 +08:00