pjson 2.0.0
A small, owning JSON value for C++11
Loading...
Searching...
No Matches
ByteDance::pjson::PatchError Struct Reference

Structured JSON Patch (RFC 6902) / Merge Patch (RFC 7396) failure. More...

#include <pjson.h>

Public Types

enum  Code {
  Ok , InvalidPatchDocument , OperationNotObject , MissingOp ,
  MissingPath , MissingFrom , MissingValue , InvalidOp ,
  InvalidPath , InvalidFrom , TargetMissing , InvalidArrayIndex ,
  ArrayIndexOutOfRange , MoveRootNotAllowed , MoveIntoDescendant , TestFailed ,
  ResourceLimit , AllocationFailure , InternalError
}
 Stable categories for programmatic JSON Patch failure handling. More...
 

Public Attributes

bool ok
 True exactly when code is Ok.
 
Code code
 Stable machine-readable result category.
 
size_t opIndex
 Zero-based index of the failing operation.
 
std::string op
 Operation name when available.
 
std::string path
 Destination pointer when available.
 
std::string from
 Source pointer when available.
 
size_t tokenIndex
 Zero-based index of the failing pointer token.
 
std::string token
 Decoded failing pointer token when available.
 
std::string message
 Human-readable diagnostic; wording is not stable. Constructs a successful patch state with no operation or token details.
 

Detailed Description

Structured JSON Patch (RFC 6902) / Merge Patch (RFC 7396) failure.

Patch application is atomic: failure leaves the target unchanged. Reporting patch APIs reset all fields on entry and on success.

Definition at line 156 of file pjson.h.

Member Enumeration Documentation

◆ Code

Stable categories for programmatic JSON Patch failure handling.

Enumerator
Ok 

Patch application succeeded.

InvalidPatchDocument 

The patch document is not an array.

OperationNotObject 

An operation entry is not an object.

MissingOp 

An operation lacks a string op member.

MissingPath 

An operation lacks a string path member.

MissingFrom 

A copy or move lacks a string from member.

MissingValue 

An add, replace, or test lacks value.

InvalidOp 

The operation name is unsupported.

InvalidPath 

The destination JSON Pointer is invalid.

InvalidFrom 

The source JSON Pointer is invalid.

TargetMissing 

A required source, parent, or target is absent.

InvalidArrayIndex 

An array path token is not a valid index.

ArrayIndexOutOfRange 

An array path token exceeds valid bounds.

MoveRootNotAllowed 

A move attempts to remove the document root.

MoveIntoDescendant 

A move destination lies under its source.

TestFailed 

A test operation did not compare equal.

ResourceLimit 

A configured patch-work limit was reached.

AllocationFailure 

Patch application could not allocate.

InternalError 

An unexpected internal exception was contained.

Definition at line 158 of file pjson.h.

Member Data Documentation

◆ code

Code ByteDance::pjson::PatchError::code

Stable machine-readable result category.

Definition at line 181 of file pjson.h.

◆ from

std::string ByteDance::pjson::PatchError::from

Source pointer when available.

Definition at line 185 of file pjson.h.

◆ message

std::string ByteDance::pjson::PatchError::message

Human-readable diagnostic; wording is not stable. Constructs a successful patch state with no operation or token details.

Definition at line 188 of file pjson.h.

◆ ok

bool ByteDance::pjson::PatchError::ok

True exactly when code is Ok.

Definition at line 180 of file pjson.h.

◆ op

std::string ByteDance::pjson::PatchError::op

Operation name when available.

Definition at line 183 of file pjson.h.

◆ opIndex

size_t ByteDance::pjson::PatchError::opIndex

Zero-based index of the failing operation.

Definition at line 182 of file pjson.h.

◆ path

std::string ByteDance::pjson::PatchError::path

Destination pointer when available.

Definition at line 184 of file pjson.h.

◆ token

std::string ByteDance::pjson::PatchError::token

Decoded failing pointer token when available.

Definition at line 187 of file pjson.h.

◆ tokenIndex

size_t ByteDance::pjson::PatchError::tokenIndex

Zero-based index of the failing pointer token.

Definition at line 186 of file pjson.h.


The documentation for this struct was generated from the following file: