From c350e7d96e4b9e7ab69f0ff47e1baf98a8cb2a5e Mon Sep 17 00:00:00 2001 From: Burrito Date: Wed, 4 Sep 2024 11:47:18 +0800 Subject: [PATCH] Fix level data status code on error (#9) --- src/sonolus/level/data.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonolus/level/data.ts b/src/sonolus/level/data.ts index c1d8609..662e9c2 100644 --- a/src/sonolus/level/data.ts +++ b/src/sonolus/level/data.ts @@ -11,7 +11,7 @@ import { sonolus } from '../index.js' const cachePath = resolve('./cache', 'LevelData', version) export const installLevelData = () => { - sonolus.router.get('/sonolus/levels/:name/data', (req, res, next) => { + sonolus.router.get('/sonolus/levels/:name/data', (req, res) => { const item = sonolus.level.items.find(({ name }) => name === req.params.name) if (!item) { res.status(404).end() @@ -38,7 +38,7 @@ export const installLevelData = () => { await writeFile(path, buffer) } catch (error) { console.error(error) - next() + res.status(500).end() } }) })