ump_spec.errors
module ump-spec
Typed UMP error with RFC 9457 conversion. Codes and HTTP statuses come from
registries/error_codes.yaml (spec §19 and §25.4). Each code has exactly one status: a code whose
registered status is an error status (400 or above) always takes it, whatever status= says; only a note
code raised as a stop (registered 200) takes the caller’s status, and an unregistered
code keeps the status it was given (400 by default).
Re-exports
Section titled “Re-exports”Documented on the page of the module that defines them.
| Name | Kind | Summary |
|---|---|---|
PROBLEM_BASE | constant | Spec §19 problem type base (fixed at publication, §24). |
problem_type | function | Spec §19: the one registered type URI of a code (base + lower case, underscores to hyphens). |
Classes
Section titled “Classes”UmpError
Section titled “UmpError”class
class UmpError(Exception)Raise anywhere; convert with to_problem(); the SDK app factory renders it.
Fields
| Name | Type | Default | Description |
|---|---|---|---|
code | code | ||
detail | detail or info.get('title', code) | ||
status | status or registered | ||
title | info.get('title', code.replace('_', ' ').title()) | ||
pointer | pointer | ||
suggested_action | suggested_action or info.get('suggested_action') | ||
untrusted_text | untrusted_text | ||
gate_id | gate_id or gate | ||
errors | errors or [] | ||
fallbacks | fallbacks or [] | ||
extra | extra or {} |
Methods and properties (3)
init constructor
UmpError( self, code: str, detail: str = '', *, status: int | None = None, pointer: str | None = None, suggested_action: str | None = None, untrusted_text: str | None = None, gate_id: str | None = None, gate: str | None = None, errors: list[ProblemIssue] | None = None, fallbacks: list[FallbackEntry] | None = None, extra: dict[str, Any] | None = None,) -> Nonegate property
gate: str | NonePython alias of gate_id (the wire member is gate_id, spec §19).
to_problem method
def to_problem(self, *, instance: str | None = None) -> ProblemSource: packages/ump-spec/src/ump_spec/errors.py, line 16
Functions
Section titled “Functions”problem
Section titled “problem”function
def problem(code: str, detail: str = '', **kw: Any) -> ProblemSource: packages/ump-spec/src/ump_spec/errors.py, line 77