Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Include delve error in apicall error logs (#1815)
Browse files Browse the repository at this point in the history
  • Loading branch information
lggomez authored and ramya-rao-a committed Jul 30, 2018
1 parent 3dd7b10 commit 751d613
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ class Delve {
}
}, err => {
if (!this.debugProcess && err) {
return logError('Failed to halt.');
return logError('Failed to halt - ' + err.toString());
}
}).then(() => {
if (this.debugProcess) {
Expand Down Expand Up @@ -701,7 +701,7 @@ class GoDebugSession extends DebugSession {
}

if (err) {
logError('Failed to get threads.');
logError('Failed to get threads - ' + err.toString());
return this.sendErrorResponse(response, 2003, 'Unable to display threads: "{e}"', { e: err.toString() });
}
const goroutines = this.delve.isApiV1 ? <DebugGoroutine[]>out : (<ListGoroutinesOut>out).Goroutines;
Expand Down Expand Up @@ -754,15 +754,15 @@ class GoDebugSession extends DebugSession {
const listLocalVarsIn = { goroutineID: this.debugState.currentGoroutine.id, frame: args.frameId };
this.delve.call<DebugVariable[] | ListLocalVarsOut>('ListLocalVars', this.delve.isApiV1 ? [listLocalVarsIn] : [{ scope: listLocalVarsIn, cfg: this.delve.loadConfig }], (err, out) => {
if (err) {
logError('Failed to list local variables.');
logError('Failed to list local variables - ' + err.toString());
return this.sendErrorResponse(response, 2005, 'Unable to list locals: "{e}"', { e: err.toString() });
}
const locals = this.delve.isApiV1 ? <DebugVariable[]>out : (<ListLocalVarsOut>out).Variables;
verbose('locals', locals);
let listLocalFunctionArgsIn = { goroutineID: this.debugState.currentGoroutine.id, frame: args.frameId };
this.delve.call<DebugVariable[] | ListFunctionArgsOut>('ListFunctionArgs', this.delve.isApiV1 ? [listLocalFunctionArgsIn] : [{ scope: listLocalFunctionArgsIn, cfg: this.delve.loadConfig }], (err, outArgs) => {
if (err) {
logError('Failed to list function args.');
logError('Failed to list function args - ' + err.toString());
return this.sendErrorResponse(response, 2006, 'Unable to list args: "{e}"', { e: err.toString() });
}
const args = this.delve.isApiV1 ? <DebugVariable[]>outArgs : (<ListFunctionArgsOut>outArgs).Args;
Expand Down Expand Up @@ -891,7 +891,7 @@ class GoDebugSession extends DebugSession {
// [TODO] Can we avoid doing this? https://github.com/Microsoft/vscode/issues/40#issuecomment-161999881
this.delve.call<DebugGoroutine[] | ListGoroutinesOut>('ListGoroutines', [], (err, out) => {
if (err) {
logError('Failed to get threads.');
logError('Failed to get threads - ' + err.toString());
}
const goroutines = this.delve.isApiV1 ? <DebugGoroutine[]>out : (<ListGoroutinesOut>out).Goroutines;
// Assume we need to stop all the threads we saw before...
Expand Down Expand Up @@ -924,7 +924,7 @@ class GoDebugSession extends DebugSession {
verbose('ContinueRequest');
this.delve.call<DebuggerState | CommandOut>('Command', [{ name: 'continue' }], (err, out) => {
if (err) {
logError('Failed to continue.');
logError('Failed to continue - ' + err.toString());
}
const state = this.delve.isApiV1 ? <DebuggerState>out : (<CommandOut>out).State;
verbose('continue state', state);
Expand All @@ -939,7 +939,7 @@ class GoDebugSession extends DebugSession {
verbose('NextRequest');
this.delve.call<DebuggerState | CommandOut>('Command', [{ name: 'next' }], (err, out) => {
if (err) {
logError('Failed to next.');
logError('Failed to next - ' + err.toString());
}
const state = this.delve.isApiV1 ? <DebuggerState>out : (<CommandOut>out).State;
verbose('next state', state);
Expand All @@ -954,7 +954,7 @@ class GoDebugSession extends DebugSession {
verbose('StepInRequest');
this.delve.call<DebuggerState | CommandOut>('Command', [{ name: 'step' }], (err, out) => {
if (err) {
logError('Failed to step.');
logError('Failed to step - ' + err.toString());
}
const state = this.delve.isApiV1 ? <DebuggerState>out : (<CommandOut>out).State;
verbose('stop state', state);
Expand All @@ -969,7 +969,7 @@ class GoDebugSession extends DebugSession {
verbose('StepOutRequest');
this.delve.call<DebuggerState | CommandOut>('Command', [{ name: 'stepOut' }], (err, out) => {
if (err) {
logError('Failed to stepout.');
logError('Failed to stepout - ' + err.toString());
}
const state = this.delve.isApiV1 ? <DebuggerState>out : (<CommandOut>out).State;
verbose('stepout state', state);
Expand All @@ -984,7 +984,7 @@ class GoDebugSession extends DebugSession {
verbose('PauseRequest');
this.delve.call<DebuggerState | CommandOut>('Command', [{ name: 'halt' }], (err, out) => {
if (err) {
logError('Failed to halt.');
logError('Failed to halt - ' + err.toString());
return this.sendErrorResponse(response, 2010, 'Unable to halt execution: "{e}"', { e: err.toString() });
}
const state = this.delve.isApiV1 ? <DebuggerState>out : (<CommandOut>out).State;
Expand Down

0 comments on commit 751d613

Please sign in to comment.