Skip to content

Commit a6cef7c

Browse files
committed
Detect even more error cases
1 parent d569622 commit a6cef7c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

arduino-debugger-extension/src/node/debug-adapter/arduino-parser.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ export class ArduinoParser extends MIParser {
5050
this.pos = 0;
5151
this.handleLine();
5252
// Detect error emitted as log message
53-
if (line.startsWith('&"error') && this.rejectReady) {
54-
this.line = line;
55-
this.pos = 0;
56-
this.next();
53+
if (this.rejectReady && line.toLowerCase().startsWith('&"error')) {
54+
this.pos = 1;
5755
this.rejectReady(new Error(this.handleCString() || regexArray[1]));
5856
this.rejectReady = undefined;
5957
}
@@ -72,7 +70,7 @@ export class ArduinoParser extends MIParser {
7270
const line = regexArray[1];
7371
this.gdb.emit('consoleStreamOutput', line + '\n', 'stderr');
7472
// Detect error emitted on the stderr stream
75-
if (line.toLowerCase().startsWith('error') && this.rejectReady) {
73+
if (this.rejectReady && line.toLowerCase().startsWith('error')) {
7674
this.rejectReady(new Error(line));
7775
this.rejectReady = undefined;
7876
}

0 commit comments

Comments
 (0)