pub fn error_invocation(call_id: &str, err: JmapError) -> InvocationExpand description
Wrap a method-level error as an error Invocation for methodResponses.
Per RFC 8620 §3.6.2, error invocations always use "error" as the method
name regardless of the original method. Only call_id is echoed.
Method-level errors are returned inside methodResponses with HTTP 200 —
they are NOT returned as top-level HTTP errors.
§Panics
Panics if err does not serialize to JSON. The derived Serialize for
JmapError writes only a type string, optional string and integer
fields and a string-keyed map of extra properties, none of which can
fail, so this does not happen; the test
jmap_error_all_constructors_serialize covers every constructor. A panic
here would mean a change to JmapError broke that invariant.