Skip to content

Commit 504d896

Browse files
committed
Fix open line being printed when open fails
Opening the URL can fail if the user doesn't have something appropriate installed to handle it.
1 parent dc177ab commit 504d896

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/node/entry.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,12 @@ const main = async (args: DefaultedArgs): Promise<void> => {
162162
if (!args.socket && args.open) {
163163
// The web socket doesn't seem to work if browsing with 0.0.0.0.
164164
const openAddress = serverAddress.replace("://0.0.0.0", "://localhost")
165-
await open(openAddress).catch((error: Error) => {
165+
try {
166+
await open(openAddress)
167+
logger.info(`Opened ${openAddress}`)
168+
} catch (error) {
166169
logger.error("Failed to open", field("address", openAddress), field("error", error))
167-
})
168-
logger.info(`Opened ${openAddress}`)
170+
}
169171
}
170172
}
171173

0 commit comments

Comments
 (0)