From e27d42d37d0d6060be5775e83eb489b1456ea95a Mon Sep 17 00:00:00 2001 From: Avior Date: Wed, 7 Dec 2022 16:23:57 +0100 Subject: [PATCH] fix: Error returned from Code::Stats Signed-off-by: Avior --- index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.ts b/index.ts index 98e7596..38ca716 100644 --- a/index.ts +++ b/index.ts @@ -21,6 +21,12 @@ app.get('/', async (req, res) => { // Generate the STL const bfr = await generateThingy(username, yearN) + if (!bfr) { + res.status(500) + .send('It seems the generator could not generate, Please open an issue on Github https://github.com/aviortheking/codestats-skyline/issues/new') + return + } + // force download the STL with a good name res .setHeader('Content-Disposition', `attachment; filename=${username}-${year ? year : 'full'}.stl`)