Fixed error messages for internal commands (fix #46)

This commit is contained in:
WebFreak001 2016-03-10 10:38:22 +01:00
commit 4cbb822d39
2 changed files with 7 additions and 3 deletions

View file

@ -258,7 +258,7 @@ export class MI2 extends EventEmitter implements IBackend {
handled = true;
}
}
if (parsed.resultRecords && parsed.resultRecords.resultClass == "error") {
if (!handled && parsed.resultRecords && parsed.resultRecords.resultClass == "error") {
this.log("stderr", parsed.result("msg") || line);
}
if (parsed.outOfBandRecord) {

View file

@ -172,7 +172,7 @@ export class MI2DebugSession extends DebugSession {
this.miDebugger.getStackVariables(1, parseInt(id.substr("@frame:".length))).then(stack => {
stack.forEach(variable => {
if (variable[1] !== undefined) {
let expanded = expandValue(createVariable, `{${variable[0]} = ${variable[1]}}`);
let expanded = expandValue(createVariable, "{" + variable[0] + "=" + variable[1] + ")");
if (!expanded)
new OutputEvent("Could not expand " + variable[1] + "\n", "stderr");
else if (typeof expanded[0] == "string")
@ -196,7 +196,7 @@ export class MI2DebugSession extends DebugSession {
};
this.sendResponse(response);
}, err => {
this.sendErrorResponse(response, 1, `Could not expand variable: ${err}`);
this.sendErrorResponse(response, 1, "Could not expand variable: " + err);
});
}
else {
@ -287,12 +287,16 @@ export class MI2DebugSession extends DebugSession {
result: res.result("value")
}
this.sendResponse(response);
}, msg => {
this.sendErrorResponse(response, 7, msg.toString());
});
else {
this.miDebugger.sendUserInput(args.expression).then(output => {
if (output)
response.body.result = JSON.stringify(output);
this.sendResponse(response);
}, msg => {
this.sendErrorResponse(response, 8, msg.toString());
});
}
}