pig-dam-core
Version:
Library that should be included in every Pig DAM project we build
53 lines • 1.72 kB
TypeScript
/**
* Date: 3/5/2018
* Time: 9:10 PM
* @license MIT (see project's LICENSE file)
*
* NOTE: we do not want to use PigError here 'cause he uses us
*/
/**
* Gets the current execution stack as a string.
* Note: it strips the message off of the stack
*/
export declare function getStack({ popCount, maxLines }?: {
popCount?: number | undefined;
maxLines?: number | undefined;
}): string;
/**
* Gets the stack, parses it via `parseStack` and refines it as requested
* @param errorOrStack - either is the stack or is an error from which we will pull the stack
* @param popCount - number of lines to pop off the top
* @param maxLines - max number of stack lines to include (stacks can get very long and noisy
* And returns him back to you so you can hug and kiss him and call him?
*/
export declare function groomStack(errorOrStack: Error | string, { popCount, maxLines }?: {
popCount?: number | undefined;
maxLines?: number | undefined;
}): string;
/**
* Splits this fellow up into the message and the call history. It removes all formatting (leading
* and trailing white space).
*
* Sample stack
* "Error Message\n" +
* " at repl:1:7\n" +
* " at Script.runInThisContext (vm.js:120:20)\n" +
* " at REPLServer.defaultEval (repl.js:431:29)\n" +
* " ...";
*/
export declare function parseStack(errorOrStack: Error | string): {
lines: string[];
message: string;
};
/**
* Parses a line of call history in a stack (not the message).
* @throws {Error} if unable to parse
*/
export declare function parseStackLine(line: string): {
column: number;
context?: string;
line: number;
module: string;
method?: string;
};
//# sourceMappingURL=stack.d.ts.map