mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-07-20 13:16:08 +00:00
* fix(api): return 404 instead of 500 for missing resources in CRUD endpoints (#862) ObjectModel.get() raises NotFoundError for a missing record (never returns a falsy value), so the 'if not obj: 404' guards were dead code and each handler's broad 'except Exception' re-raised NotFoundError as 500, never hitting the global NotFoundError->404 handler. Add an explicit 'except NotFoundError -> 404' arm to the affected handlers in notebooks, notes, models, credentials and embedding routers, plus regression tests asserting 404 (not 500) when .get() raises NotFoundError. * refactor(api): remove dead 'if not obj' guards after .get() (cubic #924) Now that each handler maps NotFoundError -> 404, the 'if not obj: raise 404' guards are unreachable (.get() raises rather than returning a falsy value). Drop them; where the fetched object was only used by the guard, keep the .get() call for its existence-validation side effect without binding an unused var. |
||
|---|---|---|
| .. | ||
| conftest.py | ||
| README.md | ||
| test_chunking.py | ||
| test_credentials_api.py | ||
| test_crud_404.py | ||
| test_domain.py | ||
| test_embedding.py | ||
| test_embedding_commands.py | ||
| test_graphs.py | ||
| test_models_api.py | ||
| test_notes_api.py | ||
| test_podcast_path.py | ||
| test_search_api.py | ||
| test_sources_api.py | ||
| test_url_validation.py | ||
| test_utils.py | ||
Coming Soon