Odoo GraphQL Subscription using Node, Express JS for Sample
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
933 B

/**
* Captures a StackTrace and (if passed) cuts off
* the first lines including the calling function.
*/
export function captureStackTrace(callingFunction) {
var stack = "";
try {
throw new Error("");
}
catch (e) {
(stack = e.stack);
}
var callerName = typeof callingFunction === "string" ? callingFunction
: callingFunction ? callingFunction.name
: undefined;
if (callerName && stack.includes(callerName)) {
var lines = stack.split("\n");
stack = lines
.slice(
// @ts-expect-error this is too old of a TS target, but node has it
lines.findLastIndex(function (line) { return line.includes(callerName); }) + 1)
.join("\n");
}
return stack;
}
export function applyStackTrace(error, stackTrace) {
error.stack = error.message + "\n" + stackTrace;
return error;
}
//# sourceMappingURL=traces.js.map