Skip to content

Commit

Permalink
wrap potential Invalid URL error
Browse files Browse the repository at this point in the history
  • Loading branch information
gobengo committed Mar 21, 2024
1 parent 26fb50d commit ed2b1d5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/api/test/nfts-upload.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,13 @@ async function createListeningMockW3up() {
const serverAddress = server.address()
if (typeof serverAddress === 'string')
throw new Error('server.address() must not return a string')
const url = new URL(`http://localhost:${serverAddress?.port ?? ''}`)
const urlString = `http://localhost:${serverAddress?.port ?? ''}`
let url
try {
url = new URL(urlString)
} catch (error) {
throw new Error(`unable to parse URL from "${urlString}"`, { cause: error })
}
return {
get requestCount() {
return requestCount
Expand Down

0 comments on commit ed2b1d5

Please sign in to comment.