#[non_exhaustive]pub enum PatchPathError {
ParentMissing,
InsideArray,
ParentNotObject,
InvalidEscape,
PrefixConflict,
DepthExceeded,
InsideBinary,
}Expand description
Error returned by apply_jmap_patch and apply_patch_object when
a PatchObject cannot be applied.
Every variant is an RFC 8620 §5.3 violation for which “the update
MUST be rejected with an “invalidPatch” error“. Callers SHOULD map
any variant to SetError with
SetErrorType::InvalidPatch;
the Display form is suitable as its description.
Marked #[non_exhaustive] so further §5.3 checks can be added
without an API break.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ParentMissing
A part before the last does not exist on the patched object.
InsideArray
A part before the last names an array, so the pointer would reference inside an array.
ParentNotObject
A part before the last names a value that is neither an object nor an array (string, number, boolean or null), which has no members.
InvalidEscape
A ~ in the path is not followed by 0 or 1, so the path is
not a valid RFC 6901 JSON Pointer.
PrefixConflict
The pointer of one patch is a prefix of the pointer of another in
the same PatchObject (e.g. "alerts/1/offset" and "alerts").
DepthExceeded
The path’s segment count plus the value’s object/array nesting
exceeds the crate’s MAX_MERGE_PATCH_DEPTH DoS-guard cap.
Not an RFC 8620 §5.3 rule: it is this crate’s server limit (RFC 8620 §3.6.1 lets a server reject requests that exceed its limits), so repeated path patches cannot grow a stored value’s depth without bound. It is still reported as invalidPatch.
InsideBinary
A part before the last is a Binary value inside a metadata or
privateMetadata namespace value: draft-ietf-jmap-metadata-05
§3.2, “a path that traverses an array or a Binary value (Section
2.1.1) is rejected with an “invalidPatch” SetError“.
Trait Implementations§
Source§impl Clone for PatchPathError
impl Clone for PatchPathError
Source§impl Debug for PatchPathError
impl Debug for PatchPathError
Source§impl Display for PatchPathError
impl Display for PatchPathError
impl Eq for PatchPathError
Source§impl Error for PatchPathError
impl Error for PatchPathError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()