Skip to content

Commit

Permalink
Do not silently ignore errors not caused by user closing picker (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed Nov 12, 2021
1 parent a8dc857 commit ddbe525
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ export const connect = async (button: InstallButton) => {
let port: SerialPort | undefined;
try {
port = await navigator.serial.requestPort();
} catch (err) {
console.error("User cancelled request", err);
} catch (err: any) {
if ((err as DOMException).name === "NotFoundError") {
return;
}
alert(`Error: ${err.message}`);
return;
}

Expand Down

0 comments on commit ddbe525

Please sign in to comment.