Skip to content

Commit ac6021a

Browse files
committed
fix: returning 500 when getStatus failed
Signed-off-by: Raccoon <[email protected]>
1 parent a3742e4 commit ac6021a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/status/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@ const realtime = require('../realtime/realtime')
44
const config = require('../config')
55

66
exports.getStatus = async (req, res) => {
7-
const data = await realtime.getStatus()
8-
97
res.set({
108
'Cache-Control': 'private', // only cache by client
119
'X-Robots-Tag': 'noindex, nofollow', // prevent crawling
1210
'Content-Type': 'application/json'
1311
})
14-
res.send(data)
12+
13+
try {
14+
const data = await realtime.getStatus()
15+
res.send(data)
16+
} catch (e) {
17+
console.error(e)
18+
res.status(500).send(e.toString())
19+
}
1520
}
1621

1722
exports.getMetrics = async (req, res) => {

0 commit comments

Comments
 (0)