Skip to content

Commit c04d4fa

Browse files
committed
Add fileset does not exist error
1 parent 9b33606 commit c04d4fa

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

src/server.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,22 @@ export function createApp(siteId: string, branchOrRef: string) {
9090

9191
const manifest = await downloadManifest(requestBranchOrRef);
9292
if (!manifest) {
93-
// TODO: Consolidate not found errors.
94-
res.sendStatus(404);
93+
res
94+
.status(404)
95+
.sendFile(
96+
fsPath.join(__dirname, './static/', 'fileset-does-not-exist.html')
97+
);
9598
return;
9699
}
97100

98101
const manifestPaths = manifest.paths;
99102

100103
if (!manifestPaths) {
101-
res.sendStatus(404);
104+
res
105+
.status(404)
106+
.sendFile(
107+
fsPath.join(__dirname, './static/', 'fileset-does-not-exist.html')
108+
);
102109
return;
103110
}
104111
const blobKey = manifestPaths[blobPath];
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<meta name="viewport" content="width=device-width, initial-scale=1">
3+
<meta charset="utf-8">
4+
<title>Page not found</title>
5+
<link rel="preconnect" href="https://fonts.gstatic.com">
6+
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@300;700&display=swap" rel="stylesheet">
7+
<style>
8+
body {
9+
-webkit-font-smoothing: subpixel-antialiased;
10+
font-family: 'Nunito', sans-serif;
11+
padding-bottom: 80px;
12+
padding-left: 20px;
13+
padding-right: 20px;
14+
padding-top: 100px;
15+
text-align: center;
16+
}
17+
p {
18+
font-size: 20px;
19+
}
20+
</style>
21+
<body>
22+
<h1>Something went&nbsp;wrong</h1>
23+
<p>The requested fileset does not exist.</p>

0 commit comments

Comments
 (0)