Skip to content

Commit 047dce9

Browse files
authored
catch ERR_INVALID_URL (#176)
closes #170
1 parent 9da8450 commit 047dce9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/preview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class Server {
4545

4646
_handleRequest: RequestListener = async (req, res) => {
4747
console.log(req.method, req.url);
48-
const url = new URL(req.url!, "http://localhost");
49-
let {pathname} = url;
5048
try {
49+
const url = new URL(req.url!, "http://localhost");
50+
let {pathname} = url;
5151
if (pathname === "/_observablehq/runtime.js") {
5252
send(req, "/@observablehq/runtime/dist/runtime.js", {root: "./node_modules"}).pipe(res);
5353
} else if (pathname.startsWith("/_observablehq/")) {

0 commit comments

Comments
 (0)