Context
HTTPException maps to status + JSON body (oxyroute/exceptions.py, src/dispatch.rs).
Other exceptions → 500 with safe body (OXYROUTE_DEBUG for detail).
docs/feature.md notes missing register_exception_handler (partial scope of feat: global HTTPException and exception handlers #48 ).
Problem
Users cannot register handlers for domain-specific exception types (e.g. NotFoundError, ValidationError) without wrapping every route handler.
Proposed change
App.register_exception_handler(exc_type, handler) storing a type → callable registry.
On PyErr from route / dependency / middleware, walk the registry (subclass match) and map to Response / dict / str like normal handlers.
Production 500 remains safe when no handler matches.
Files
oxyroute/app.py, oxyroute/exceptions.py, src/dispatch.rs, src/lib.rs
docs/handlers.md, tests
Acceptance criteria
Custom exception maps to expected status and body.
Subclass matching is predictable (most specific wins).
Unhandled exceptions still return safe 500 JSON.
Docs include a minimal example.
Framework impact
Centralized error handling for domain and validation errors.
Context
HTTPExceptionmaps to status + JSON body (oxyroute/exceptions.py,src/dispatch.rs).OXYROUTE_DEBUGfor detail).docs/feature.mdnotes missingregister_exception_handler(partial scope of feat: global HTTPException and exception handlers #48).Problem
Users cannot register handlers for domain-specific exception types (e.g.
NotFoundError,ValidationError) without wrapping every route handler.Proposed change
App.register_exception_handler(exc_type, handler)storing a type → callable registry.PyErrfrom route / dependency / middleware, walk the registry (subclass match) and map toResponse/ dict / str like normal handlers.Files
oxyroute/app.py,oxyroute/exceptions.py,src/dispatch.rs,src/lib.rsdocs/handlers.md, testsAcceptance criteria
Framework impact
Centralized error handling for domain and validation errors.