Skip to content

Commit be25144

Browse files
committed
add a bit of error checking code
1 parent 0734ac3 commit be25144

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

client.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ class ServerConn {
111111
}
112112

113113
const req = await fetch(url, options)
114+
// TODO retry if server is not available
115+
if (req.status >= 400) {
116+
const text = await req.text()
117+
throw `server responsed with [${req.status}] ${req.statusText}: ${text}`
118+
}
114119
return await req.json()
115120
}
116121

0 commit comments

Comments
 (0)