MCPcopy Create free account
hub / github.com/Kong/insomnia / errorJSON

Function errorJSON

packages/insomnia-testing/src/run/javascript-reporter.ts:128–135  ·  view source on GitHub ↗
(error: Error)

Source from the content-addressed store, hash-verified

126 * Transform an Error object into a JSON object.
127 */
128const errorJSON = (error: Error) => {
129 return (Object.getOwnPropertyNames(error) as (keyof Error)[]).reduce((accumulator, key) => {
130 return {
131 ...accumulator,
132 [key]: error[key],
133 };
134 }, {});
135};

Callers 1

cleanFunction · 0.85

Calls 1

reduceMethod · 0.80

Tested by

no test coverage detected