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

Commit

Permalink
Send exception text - fix #181
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Mar 3, 2017
1 parent d973e62 commit 2f21c68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/chrome/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,10 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {

// Enforce that the stopped event is not fired until we've send the response to the step that induced it.
// Also with a timeout just to ensure things keep moving
const sendStoppedEvent = () =>
this._session.sendEvent(new StoppedEvent(this.stopReasonText(reason), /*threadId=*/ChromeDebugAdapter.THREAD_ID));
const sendStoppedEvent = () => {
const exceptionText = this._exception && this._exception.description && utils.firstLine(this._exception.description);
return this._session.sendEvent(new StoppedEvent(this.stopReasonText(reason), /*threadId=*/ChromeDebugAdapter.THREAD_ID, exceptionText));
}
return utils.promiseTimeout(this._currentStep, /*timeoutMs=*/300)
.then(sendStoppedEvent, sendStoppedEvent);
}
Expand Down
8 changes: 8 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,3 +507,11 @@ export function makeRegexMatchPath(regex: RegExp, aPath: string): RegExp {
export type Partial<T> = {
[P in keyof T]?: T[P];
};

export function getLine(msg: string, n = 0): string {
return msg.split('\n')[n];
}

export function firstLine(msg: string): string {
return getLine(msg);
}

0 comments on commit 2f21c68

Please sign in to comment.