From a6cef7c605abb724e4fbc568105c94b440926259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Sp=C3=B6nemann?= Date: Wed, 26 Feb 2020 13:55:12 +0100 Subject: [PATCH] Detect even more error cases --- .../src/node/debug-adapter/arduino-parser.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arduino-debugger-extension/src/node/debug-adapter/arduino-parser.ts b/arduino-debugger-extension/src/node/debug-adapter/arduino-parser.ts index 3922367b..8f29b525 100644 --- a/arduino-debugger-extension/src/node/debug-adapter/arduino-parser.ts +++ b/arduino-debugger-extension/src/node/debug-adapter/arduino-parser.ts @@ -50,10 +50,8 @@ export class ArduinoParser extends MIParser { this.pos = 0; this.handleLine(); // Detect error emitted as log message - if (line.startsWith('&"error') && this.rejectReady) { - this.line = line; - this.pos = 0; - this.next(); + if (this.rejectReady && line.toLowerCase().startsWith('&"error')) { + this.pos = 1; this.rejectReady(new Error(this.handleCString() || regexArray[1])); this.rejectReady = undefined; } @@ -72,7 +70,7 @@ export class ArduinoParser extends MIParser { const line = regexArray[1]; this.gdb.emit('consoleStreamOutput', line + '\n', 'stderr'); // Detect error emitted on the stderr stream - if (line.toLowerCase().startsWith('error') && this.rejectReady) { + if (this.rejectReady && line.toLowerCase().startsWith('error')) { this.rejectReady(new Error(line)); this.rejectReady = undefined; }