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

Commit

Permalink
Fix #226 - fix for old runtimes that don't support setAsyncCallStackD…
Browse files Browse the repository at this point in the history
…epth
  • Loading branch information
roblourens committed Aug 14, 2017
1 parent ca08838 commit 9881b3c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/chrome/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,12 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {
await Promise.all(this.runConnection());

const maxDepth = this._launchAttachArgs.showAsyncStacks ? ChromeDebugAdapter.ASYNC_CALL_STACK_DEPTH : 0;
return this.chrome.Debugger.setAsyncCallStackDepth({ maxDepth });
try {
return this.chrome.Debugger.setAsyncCallStackDepth({ maxDepth });
} catch (e) {
// Not supported by older runtimes, ignore it.
return;
}
} else {
return Promise.resolve();
}
Expand Down

3 comments on commit 9881b3c

@itoys
Copy link

@itoys itoys commented on 9881b3c Aug 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried and this is not worked
setAsyncCallStackDepth return Promise with 'async' call inside and hence in case if method doesn't exist it doesn't throw an exception but returns a rejected promise instead.
https://github.com/nojvek/noice-json-rpc/blob/master/lib/noice-json-rpc.js#L101
I guess this is better:

return this.chrome.Debugger.setAsyncCallStackDepth({ maxDepth })
                    .catch(() => {
                        // Not supported by older runtimes, ignore it.
                        Promise.resolve();
                    });

@roblourens
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I meant return await...

@roblourens
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a new commit, you can try the new one.

Please sign in to comment.