MCPcopy Create free account
hub / github.com/Starcounter-Jack/JSON-Patch / patchErrorMessageFormatter

Function patchErrorMessageFormatter

src/helpers.ts:149–158  ·  view source on GitHub ↗
(message: String, args: Object)

Source from the content-addressed store, hash-verified

147 'TEST_OPERATION_FAILED';
148
149function patchErrorMessageFormatter(message: String, args: Object): string {
150 const messageParts = [message];
151 for (const key in args) {
152 const value = typeof args[key] === 'object' ? JSON.stringify(args[key], null, 2) : args[key]; // pretty print
153 if (typeof value !== 'undefined') {
154 messageParts.push(`${key}: ${value}`);
155 }
156 }
157 return messageParts.join('\n');
158}
159export class PatchError extends Error {
160 constructor(message: string, public name: JsonPatchErrorName, public index?: number, public operation?: any, public tree?: any) {
161 super(patchErrorMessageFormatter(message, { name, index, operation, tree }));

Callers 1

constructorMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected