You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, I'm already working on it (I will describe it in the PR once it's done, but will take some weeks). Upgrading to Connexion 3 will require this change anyway.
Status update: the bug fixes (503, MRO lookup, single log record) are in PR 6. For v0.14.0 we would simplify the API itself and make the handler independent of Flask, so that the Connexion 3 migration only needs to swap a thin adapter:
Core: a pure build_problem(exc, conf: ExceptionConfig) -> tuple[dict, int] that resolves the problem along type(exc).__mro__, then falls back to the exception's HTTP status (code or status_code attribute), then to 500. This means werkzeug, Connexion and (later) Starlette exceptions with the same status share one entry.
Adapter:register_exception_handler(app, conf) binds the config by closure instead of reading current_app; today it returns a Flask Response, later a ConnexionResponse.
Defaults: RFC 9457 problem details keyed by status code (title, status, optional detail); no need to list werkzeug classes.
Config: replace required_members, extension_members, status_member, public_members and private_members with:
mapping: optional dotted path to a dict {exception class: {status, title, detail?, ...}} (replaces exceptions; status is always the status member);
public_members: optional flat list of top-level members to return (default: all);
logging: unchanged (oneline/minimal/regular/none), with _log_exception taking the enum directly.
Fixes the shallow merge of nested public_members by not supporting nested filters anymore.
Acceptance criteria
build_problem unit-tested without any app: MRO resolution, status-code fallback, default 500, member filtering.
Handler never touches current_app; HTTP tests for a werkzeug 404, a Connexion 401, a custom mapped exception and an unmapped Exception (body and application/problem+json).
ExceptionConfig, template, README and migration notes updated; old keys removed.
Breaking changes
Configs must drop required_members, extension_members, status_member, private_members and nested public_members, and rename exceptions to mapping. proTES and cloud-registry exceptions.py dicts keep working if each entry has status and title; entries that only differ from the defaults can be deleted.
Activity
kushagra189 commentedon Jun 15, 2024
Any suggestions here?
uniqueg commentedon Jun 17, 2024
Yes, I'm already working on it (I will describe it in the PR once it's done, but will take some weeks). Upgrading to Connexion 3 will require this change anyway.
uniqueg commentedon Oct 18, 2026
Refined proposal
Status update: the bug fixes (503, MRO lookup, single log record) are in PR 6. For v0.14.0 we would simplify the API itself and make the handler independent of Flask, so that the Connexion 3 migration only needs to swap a thin adapter:
build_problem(exc, conf: ExceptionConfig) -> tuple[dict, int]that resolves the problem alongtype(exc).__mro__, then falls back to the exception's HTTP status (codeorstatus_codeattribute), then to 500. This means werkzeug, Connexion and (later) Starlette exceptions with the same status share one entry.register_exception_handler(app, conf)binds the config by closure instead of readingcurrent_app; today it returns a FlaskResponse, later aConnexionResponse.title,status, optionaldetail); no need to list werkzeug classes.required_members,extension_members,status_member,public_membersandprivate_memberswith:mapping: optional dotted path to a dict{exception class: {status, title, detail?, ...}}(replacesexceptions;statusis always the status member);public_members: optional flat list of top-level members to return (default: all);logging: unchanged (oneline/minimal/regular/none), with_log_exceptiontaking the enum directly.public_membersby not supporting nested filters anymore.Acceptance criteria
build_problemunit-tested without any app: MRO resolution, status-code fallback, default 500, member filtering.current_app; HTTP tests for a werkzeug 404, a Connexion 401, a custom mapped exception and an unmappedException(body andapplication/problem+json).ExceptionConfig, template, README and migration notes updated; old keys removed.Breaking changes
Configs must drop
required_members,extension_members,status_member,private_membersand nestedpublic_members, and renameexceptionstomapping. proTES and cloud-registryexceptions.pydicts keep working if each entry hasstatusandtitle; entries that only differ from the defaults can be deleted.Planned PR
7 (
feat(errors)!: simplify exceptions API).