Skip to content

Commit 34fac1b

Browse files
authored
fix(HttpBackend): fs.readFile should throw on 404s (#24)
1 parent 3ec82a7 commit 34fac1b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/HttpBackend.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ module.exports = class HttpBackend {
55
loadSuperblock() {
66
return fetch(this._url + '/.superblock.txt').then(res => res.text())
77
}
8-
readFile(filepath) {
9-
return fetch(this._url + filepath).then(res => res.arrayBuffer())
8+
async readFile(filepath) {
9+
const res = await fetch(this._url + filepath)
10+
if (res.status === 200) {
11+
return res.arrayBuffer()
12+
} else {
13+
throw new Error('ENOENT')
14+
}
1015
}
1116
}

0 commit comments

Comments
 (0)