-
Notifications
You must be signed in to change notification settings - Fork 73
fix: handle init selectivity error #1201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,7 +81,16 @@ export const startSelectivity = async (browser: ExistingBrowser): Promise<StopSe | |
| const cssSelectivity = new CSSSelectivity(browser.cdp, sessionId, sourceRoot); | ||
| const jsSelectivity = new JSSelectivity(browser.cdp, sessionId, sourceRoot); | ||
|
|
||
| await Promise.all([cssSelectivity.start(), jsSelectivity.start()]); | ||
| await Promise.allSettled([cssSelectivity.start(), jsSelectivity.start()]).then(async ([css, js]) => { | ||
| if (css.status === "rejected" || js.status === "rejected") { | ||
| await Promise.all([cssSelectivity.stop(true), jsSelectivity.stop(true)]); | ||
|
|
||
| const originalError = | ||
| css.status === "rejected" ? css.reason : js.status === "rejected" ? js.reason : "unknown reason"; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "unknown reason" path is impossible, but typescript wants to be 100% sure |
||
|
|
||
| throw new Error(`Selectivity: Couldn't start selectivity: ${originalError}`); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like we'll lose stack and cause of original error if they are present. I'd use
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will fix it in next PR in multiple places to avoid rebases |
||
| } | ||
| }); | ||
|
|
||
| /** @param drop only performs cleanup without writing anything. Should be "true" if test is failed */ | ||
| return async function stopSelectivity(test: Test, drop: boolean): Promise<void> { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cant throw when
drop=trueis passed