avoid silencing errors reading GUI files
Massimo Melina committed
Apr 9, 2026 at 13:15 UTC
3d728c95ab79fba30aafe4a97a7d310a0d26631d
1 file changed
+5
-1
src/serveGuiFiles.ts
+5
-1
@@ -44,7 +44,11 @@ function serveStatic(uri: string): Koa.Middleware {
44
const fullPath = join(__dirname, '..', folder, serveApp ? '/index.html': ctx.path)
45
const content = await parseFile(fullPath,
46
raw => serveApp || !raw.length ? raw : adjustBundlerLinks(ctx, uri, raw) )
47
- .catch(() => null)
47
+ .catch(e => {
48
+ if (e?.code !== 'ENOENT') // not supposed to happen, and yet a user reported a strange behavior
49
+ console.error(`serveStatic/parseFile: ${String(e)}`)
50
+ return null
51
+ })
52
if (content === null)
53
return ctx.status = HTTP_NOT_FOUND
54
if (!serveApp)