Skip to content

Commit ad71494

Browse files
authored
refactor: delete unused try catch (#4638)
1 parent 633c03a commit ad71494

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

packages/vite/src/node/server/middlewares/transform.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,10 @@ export function transformMiddleware(
9393
return
9494
}
9595

96-
let url: string
97-
try {
98-
url = removeTimestampQuery(req.url!).replace(NULL_BYTE_PLACEHOLDER, '\0')
99-
} catch (err) {
100-
// if it starts with %PUBLIC%, someone's migrating from something
101-
// like create-react-app
102-
let errorMessage: string
103-
if (req.url?.startsWith('/%PUBLIC')) {
104-
errorMessage = `index.html shouldn't include environment variables like %PUBLIC_URL%, see https://vitejs.dev/guide/#index-html-and-project-root for more information`
105-
} else {
106-
errorMessage = `Vite encountered a suspiciously malformed request ${req.url}`
107-
}
108-
next(new Error(errorMessage))
109-
return
110-
}
96+
let url = removeTimestampQuery(req.url!).replace(
97+
NULL_BYTE_PLACEHOLDER,
98+
'\0'
99+
)
111100

112101
const withoutQuery = cleanUrl(url)
113102

0 commit comments

Comments
 (0)