BREAKING CHANGE(package): switch scope to @pushrocks
This commit is contained in:
35
ts/index.ts
35
ts/index.ts
@ -1,8 +1,33 @@
|
||||
import * as plugins from './smarterror.plugins'
|
||||
import * as plugins from './smarterror.plugins';
|
||||
|
||||
export class SmartError extends Error {
|
||||
name = 'SmartError'
|
||||
constructor (errorMessageArg: string) {
|
||||
super(errorMessageArg)
|
||||
import { BaseError, fullStack } from 'make-error-cause';
|
||||
|
||||
export const seperatorText = `\n\nThe following exception was the direct cause of the above exception:\n\n`;
|
||||
|
||||
export class SmartError extends BaseError {
|
||||
name = 'SmartError';
|
||||
constructor(errorMessageArg: string, errorCause?) {
|
||||
super(errorMessageArg, errorCause);
|
||||
}
|
||||
|
||||
get fullStack() {
|
||||
return fullStack(this);
|
||||
}
|
||||
|
||||
get cleanFullStack() {
|
||||
let fullCleanStack = plugins.cleanStack(this.stack);
|
||||
|
||||
let errorPointer = this as BaseError;
|
||||
|
||||
while (errorPointer.cause) {
|
||||
fullCleanStack += seperatorText;
|
||||
if (errorPointer.cause.stack) {
|
||||
fullCleanStack += plugins.cleanStack(errorPointer.cause.stack);
|
||||
} else {
|
||||
fullCleanStack += errorPointer.cause.message;
|
||||
}
|
||||
errorPointer = errorPointer.cause as BaseError;
|
||||
}
|
||||
return fullCleanStack;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,3 @@
|
||||
import 'typings-global'
|
||||
import * as cleanStack from 'clean-stack';
|
||||
|
||||
import * as cleanStack from 'clean-stack'
|
||||
import * as sourceMapSupport from 'source-map-support'
|
||||
sourceMapSupport.install()
|
||||
|
||||
export {
|
||||
cleanStack
|
||||
}
|
||||
export { cleanStack };
|
||||
|
Reference in New Issue
Block a user