UNPKG

@graphistry/falcor

Version:
23 lines (16 loc) 567 B
var clone = require('../../clone'); module.exports = onError; function onError(node, depth, results, requestedPath, fromReference, boxValues) { var index = -1; var length = depth + !!fromReference; // depth + 1 if fromReference === true var errorPath = new Array(length); var errorValue = !boxValues ? node.value : clone(node); while (++index < length) { errorPath[index] = requestedPath[index]; } (results.errors || (results.errors = [])).push({ path: errorPath, value: errorValue }); }