From 9b6e016e726acecd19272ded2f1c211fcfeeb1c7 Mon Sep 17 00:00:00 2001 From: Paul <44974737+paulober@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:49:34 +0100 Subject: [PATCH] Fix #4056, Debugger statements in production code (#4082) Signed-off-by: paulober <44974737+paulober@users.noreply.github.com> --- src/drivers/cmakeServerClient.ts | 12 +++++++++--- src/projectOutline/projectOutline.ts | 4 +++- src/rollbar.ts | 4 +++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/drivers/cmakeServerClient.ts b/src/drivers/cmakeServerClient.ts index 9aac9459e..99d94d458 100644 --- a/src/drivers/cmakeServerClient.ts +++ b/src/drivers/cmakeServerClient.ts @@ -385,7 +385,9 @@ export class CMakeServerClient { break; } if (mat.length !== 3) { - debugger; + if (process.env.NODE_ENV === 'development') { + debugger; + } throw new global.Error(localize('protocol.error.cmake', 'Protocol error talking to CMake! Got this input: {0}', input)); } this.accInput = mat[2]; @@ -474,7 +476,9 @@ export class CMakeServerClient { } } } - debugger; + if (process.env.NODE_ENV === 'development') { + debugger; + } log.warning(localize('cant.yet.handle.message', 'Can\'t yet handle the {0} messages', some.type)); } @@ -587,7 +591,9 @@ export class CMakeServerClient { pipe.on('error', e => { pipe.end(); if (!this.shutDownFlag) { - debugger; + if (process.env.NODE_ENV === 'development') { + debugger; + } rollbar.takePromise(localize('pipe.error.from.cmake-server', 'Pipe error from cmake-server'), { pipe: pipeFile }, params.onPipeError(e)); diff --git a/src/projectOutline/projectOutline.ts b/src/projectOutline/projectOutline.ts index 335cf658d..f253d6baf 100644 --- a/src/projectOutline/projectOutline.ts +++ b/src/projectOutline/projectOutline.ts @@ -381,7 +381,9 @@ export class TargetNode extends BaseNode { ].join(','); return item; } catch (e) { - debugger; + if (process.env.NODE_ENV === 'development') { + debugger; + } return new vscode.TreeItem(`${this.name} (${localize('item.render.issue', 'There was an issue rendering this item. This is a bug')})`); } } diff --git a/src/rollbar.ts b/src/rollbar.ts index 0d947c61f..ab3cd48d2 100644 --- a/src/rollbar.ts +++ b/src/rollbar.ts @@ -97,7 +97,9 @@ class RollbarController { */ error(what: string, additional: object = {}): void { log.error(what, JSON.stringify(additional, (key, value) => stringifyReplacer(key, value))); - debugger; + if (process.env.NODE_ENV === 'development') { + debugger; + } } info(what: string, additional: object = {}): void {