docs: add exception reference and error handling guide#654
Open
TheSaiEaranti wants to merge 1 commit into
Open
docs: add exception reference and error handling guide#654TheSaiEaranti wants to merge 1 commit into
TheSaiEaranti wants to merge 1 commit into
Conversation
Add docs/api/exceptions.rst and link it from the API toctree, so the exception hierarchy is documented in one discoverable place. The page covers the five classes in redisvl.exceptions, a table mapping each to the operations that raise it, and try/except examples for the two cases called out in the issue: schema validation on load and query validation. Each example is drawn from an actual raise site, so validate_on_load=True is shown for SchemaValidationError and ef_runtime on a flat vector field for QueryValidationError. Also notes that redis-py exceptions are not part of the hierarchy and that RedisVL chains the original error, since that is the part most likely to trip someone writing an except clause. Fixes redis#496
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #496
Adds
docs/api/exceptions.rstand links it from the API toctree, so the exception hierarchy has one discoverable home.What's on the page
redisvl.exceptions, and a note thatredis-pyexceptions such asredis.exceptions.ConnectionErrorare not part of it. RedisVL wraps those and chains the original withraise ... from e, so__cause__still holds it. That seemed like the detail most likely to trip someone writing anexceptclause.SchemaValidationError→load(),RedisSearchError→create()/delete()/search()/aggregate().try/exceptexamples, including the two the issue asks for.:members:/:show-inheritance:pattern used inschema.rst.Examples are drawn from real raise sites
Rather than writing plausible-looking snippets, I traced each exception to where it is actually raised so the examples match current behaviour:
SchemaValidationErrorstorage.py_preprocess_and_validate_objectsvalidate_on_load=True, since validation is off by default and the error cannot otherwise occurQueryValidationErrorindex.py_validate_queryef_runtimeon aflatvector field — the concrete case that method rejectsRedisSearchErrorcreate,delete,search,aggregateRedisModuleVersionError_check_svs_support, reached fromcreate()exceptclauses, since it subclassesRedisVLErrorand notRedisSearchErrorThe
from_yaml(..., validate_on_load=True)form matches the example already in theSearchIndexdocstring.Definition of Done
docs/_build/html/api/exceptions.htmlrenders, all five classes appear with their docstrings,RedisModuleVersionError.for_svs_vamanais documented, and the page is linked from the API index as "Exceptions".make docs-buildpasses — exit 0. The build reports 11 warnings; all 11 are pre-existing and point atquery.py/aggregate.pydocstrings inherited from redis-py,index.mdheading levels, and the MCP how-to cross-references. None referenceexceptions.rst.codespellis clean on both files. No Python changed, so no behaviour change.Notes
auto:documentationlabel per CONTRIBUTING. I can't set labels as an outside contributor — could a maintainer add it?uv.lockout. Runningmake docs-buildwith a recentuvrewrites it to lockfile revision 3 (a ~250 line diff) which has nothing to do with this change.Note
Low Risk
Documentation-only change with no runtime or API behavior impact.
Overview
Adds
docs/api/exceptions.rstas the API home for RedisVL’s custom errors and wires it into the API toctree viadocs/api/index.md.The new page documents the
RedisVLErrorhierarchy (including howredis-pyerrors are wrapped and chained on__cause__), a table mapping each exception to typicalload()/query()/create()entry points, fourtry/exceptexamples aligned with real raise sites, and autodoc blocks for all five classes inredisvl.exceptions.Reviewed by Cursor Bugbot for commit 55cf1a2. Bugbot is set up for automated code reviews on this repo. Configure here.