16 lines
421 B
TypeScript
16 lines
421 B
TypeScript
/**
|
|
* Error class used to generate debug stack traces, not thrown.
|
|
*/
|
|
export class DebuggingTraceIsNotAnError extends Error {
|
|
static getTrace(): string {
|
|
const oldLimit = Error.stackTraceLimit
|
|
if ( oldLimit < 50 ) {
|
|
Error.stackTraceLimit = 50
|
|
}
|
|
|
|
const trace = (new this()).stack || String(new this())
|
|
Error.stackTraceLimit = oldLimit
|
|
return trace
|
|
}
|
|
}
|