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