Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Commit

Permalink
Better error logging for failed requests to chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Dec 3, 2016
1 parent c61fafb commit d2e57d4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/chrome/chromeDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,24 @@ export class ChromeDebugSession extends DebugSession {
}
}

private failedRequest(requestType: string, response: DebugProtocol.Response, error: Error): void {
logger.error(`Error processing "${requestType}": ${error.stack}`);
private failedRequest(requestType: string, response: DebugProtocol.Response, error: any): void {
let errMsg: string;
if (error.data) {
// Error response from runtime
errMsg = error.message + ': ' + error.data;
} else {
errMsg = error.stack || error.message;
}

logger.error(`Error processing "${requestType}": ${errMsg}`);

// These errors show up in the message bar at the top (or nowhere), sometimes not obvious that they
// come from the adapter, so add extensionName
this.sendErrorResponse(
response,
1104,
'[{_extensionName}] Error processing "{_requestType}": {_stack}',
{ _extensionName: this._extensionName, _requestType: requestType, _stack: error.stack },
{ _extensionName: this._extensionName, _requestType: requestType, _stack: errMsg },
ErrorDestination.Telemetry);
}
}
Expand Down

0 comments on commit d2e57d4

Please sign in to comment.