Skip to content

refactor(kb): unify exception handling in KB API and RAG pipelines#122

Open
sqhyz55 wants to merge 1 commit intoxorbitsai:mainfrom
sqhyz55:feat/rag_exception_unification
Open

refactor(kb): unify exception handling in KB API and RAG pipelines#122
sqhyz55 wants to merge 1 commit intoxorbitsai:mainfrom
sqhyz55:feat/rag_exception_unification

Conversation

@sqhyz55
Copy link
Collaborator

@sqhyz55 sqhyz55 commented Mar 10, 2026

  • Add _handle_ingestion_error() in document_ingestion to centralize error handling and remove duplicated RagCoreException/Exception branches
  • Add _handle_search_error() in document_search to unify search pipeline error handling
  • Add handle_kb_exceptions decorator in kb.py for KB API routes; map ValueError/KeyError/TypeError -> 400, PermissionError/OSError -> 403, other Exception -> 500
  • Apply decorator to ingest, list_collections_api, search, ingest_web, delete_collection_api, delete_document_api, rename_collection_api, get_parse_result_api; remove redundant try/except in each handler
  • Keep list_collections_api asyncio.TimeoutError -> 503 and get_parse_result_api DocumentNotFoundError -> 404

- Add _handle_ingestion_error() in document_ingestion to centralize error
  handling and remove duplicated RagCoreException/Exception branches
- Add _handle_search_error() in document_search to unify search pipeline
  error handling
- Add handle_kb_exceptions decorator in kb.py for KB API routes; map
  ValueError/KeyError/TypeError -> 400, PermissionError/OSError -> 403,
  other Exception -> 500
- Apply decorator to ingest, list_collections_api, search, ingest_web,
  delete_collection_api, delete_document_api, rename_collection_api,
  get_parse_result_api; remove redundant try/except in each handler
- Keep list_collections_api asyncio.TimeoutError -> 503 and
  get_parse_result_api DocumentNotFoundError -> 404

Migrated from FenixAOS feat/rag_exception_unification.

Made-with: Cursor
@sqhyz55 sqhyz55 requested a review from rogercloud March 10, 2026 01:45
@sqhyz55 sqhyz55 marked this pull request as draft March 11, 2026 06:06
@sqhyz55 sqhyz55 marked this pull request as ready for review March 12, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant