Skip to content

jmaple.errors

Raise MethodError from a handler to fail the single invocation; the dispatcher converts it to the standard ["error", {...}, callId] shape per RFC 8620 §3.6.2. SetError is the per-row error returned inside Foo/set notCreated / notUpdated / notDestroyed maps.

MethodError

Bases: Exception

A method invocation failed in a way that should be reported per-call.

Wraps to ["error", {"type": <type>, "description": ..., ...}, callId] per RFC 8620 §3.6.2. Plugins should raise this from within a handler.

SetError

Bases: BaseModel

A single create/update/destroy failure inside a Foo/set response.

Standard error type constants

These are the named errors from RFC 8620. Pass to MethodError as the first positional arg.

ERR_ACCOUNT_NOT_FOUND module-attribute

ERR_ACCOUNT_NOT_FOUND = 'accountNotFound'

ERR_ACCOUNT_NOT_SUPPORTED module-attribute

ERR_ACCOUNT_NOT_SUPPORTED = 'accountNotSupportedByMethod'

ERR_ACCOUNT_READ_ONLY module-attribute

ERR_ACCOUNT_READ_ONLY = 'accountReadOnly'

ERR_CANNOT_CALCULATE_CHANGES module-attribute

ERR_CANNOT_CALCULATE_CHANGES = 'cannotCalculateChanges'

ERR_FORBIDDEN module-attribute

ERR_FORBIDDEN = 'forbidden'

ERR_INVALID_ARGUMENTS module-attribute

ERR_INVALID_ARGUMENTS = 'invalidArguments'

ERR_INVALID_RESULT_REFERENCE module-attribute

ERR_INVALID_RESULT_REFERENCE = 'invalidResultReference'

ERR_RATE_LIMIT module-attribute

ERR_RATE_LIMIT = 'rateLimit'

ERR_REQUEST_TOO_LARGE module-attribute

ERR_REQUEST_TOO_LARGE = 'requestTooLarge'

ERR_SERVER_FAIL module-attribute

ERR_SERVER_FAIL = 'serverFail'

ERR_SERVER_PARTIAL_FAIL module-attribute

ERR_SERVER_PARTIAL_FAIL = 'serverPartialFail'

ERR_SERVER_UNAVAILABLE module-attribute

ERR_SERVER_UNAVAILABLE = 'serverUnavailable'

ERR_STATE_MISMATCH module-attribute

ERR_STATE_MISMATCH = 'stateMismatch'

ERR_TOO_LARGE module-attribute

ERR_TOO_LARGE = 'tooLarge'

ERR_UNKNOWN_METHOD module-attribute

ERR_UNKNOWN_METHOD = 'unknownMethod'