Skip to content

Commit 2ffcbe3

Browse files
authored
Make TSError diagnosticText non-enumerable to prevent it from logging below stack trace (#1632)
* Make tserror diagnosticText non-enumerable to prevent it from logging below stack trace in errors * lint-fix
1 parent 26c3774 commit 2ffcbe3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/index.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,15 @@ export const DEFAULTS: RegisterOptions = {
462462
*/
463463
export class TSError extends BaseError {
464464
name = 'TSError';
465+
diagnosticText!: string;
465466

466-
constructor(public diagnosticText: string, public diagnosticCodes: number[]) {
467+
constructor(diagnosticText: string, public diagnosticCodes: number[]) {
467468
super(`⨯ Unable to compile TypeScript:\n${diagnosticText}`);
469+
Object.defineProperty(this, 'diagnosticText', {
470+
configurable: true,
471+
writable: true,
472+
value: diagnosticText,
473+
});
468474
}
469475

470476
/**

0 commit comments

Comments
 (0)