Skip to content
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

core(driver): add sendCommandAndIgnore #15913

Merged
merged 5 commits into from
Apr 10, 2024
Merged

Conversation

paulirish
Copy link
Member

followup from #15833 (review)

@paulirish paulirish requested a review from a team as a code owner April 3, 2024 01:40
@paulirish paulirish requested review from connorjclark and removed request for a team April 3, 2024 01:40
@paulirish paulirish changed the title core(driver): add sendCommandAndIgnore alias for catch(_ => {}) behavior core(driver): add sendCommandAndIgnore alias for handling rejections Apr 3, 2024
.catch(_ => {});
void session.sendCommand('Runtime.terminateExecution').catch(_ => {});
void session.sendCommandAndIgnore('Emulation.setScriptExecutionDisabled', {value: true});
void session.sendCommandAndIgnore('Runtime.terminateExecution');
Copy link
Collaborator

@connorjclark connorjclark Apr 3, 2024

Choose a reason for hiding this comment

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

Thoughts on making this return void, doing the void * hack inside the method?

if the semantics is just "toss this over to cdp and move on" we don't need to await anything.

Copy link
Member Author

Choose a reason for hiding this comment

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

hmmm yeah. i'm up for tweaking it.

the void * thing (generally a convention from the devtools codebase) is for saying.. i'm not awaiting or returning this promise. https://typescript-eslint.io/rules/no-floating-promises/#ignorevoid

but the new AndIgnore method is for.. catching the rejection so it doesn't continue (or go unhandled)

they're slightly different things, right?

and it seems like we have cases where we want to await the AndIgnore calls .. and cases where we don't want to await them
So i think this new method should still return a promise. but.. it can be empty


and given this tweak, maybe ignore isn't a great fit. wdyt sendCommandQuietly? open to other names. (but also no big whoop on naming)

@connorjclark connorjclark changed the title core(driver): add sendCommandAndIgnore alias for handling rejections core(driver): add sendCommandAndIgnore for handling rejections Apr 9, 2024
@connorjclark connorjclark changed the title core(driver): add sendCommandAndIgnore for handling rejections core(driver): add sendCommandAndIgnore Apr 9, 2024
@devtools-bot devtools-bot merged commit 7fa8370 into main Apr 10, 2024
27 checks passed
@devtools-bot devtools-bot deleted the sendCommandAndIgnore branch April 10, 2024 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants