easier spotting of permissions problems with certificate files, by warning in console
Massimo Melina committed
Jun 16, 2022 at 00:26 UTC
076bfa610325f80c783603a4800b0176e5485601
2 files changed
+7
-3
server/src/listen.ts
+2
-2
@@ -149,10 +149,10 @@ function stopServer(srv: http.Server) {
149
return resolve(null)
150
const ad = srv.address()
151
if (ad && typeof ad !== 'string')
152
- console.log('stopped port ' + ad.port)
152
+ console.log("stopped port", ad.port)
153
srv.close(err => {
154
if (err && (err as any).code !== 'ERR_SERVER_NOT_RUNNING')
155
- console.debug('failed to stop server', String(err))
155
+ console.debug("failed to stop server", String(err))
156
resolve(err)
157
})
158
})
server/src/watchLoad.ts
+5
-1
@@ -59,7 +59,11 @@ export function watchLoad(path:string, parser:(data:any)=>void|Promise<void>, {
59
data = await readFileBusy(path)
60
console.debug('loaded', path)
61
}
62
- catch (e) { return } // silently ignore read errors
62
+ catch (e: any) {
63
+ if (e.code === 'EPERM')
64
+ console.error("missing permissions on file", path) // warn user, who could be clueless about this problem
65
+ return // ignore read errors
66
+ }
67
if (path.endsWith('.yaml'))
68
data = yaml.parse(data)
69
await parser(data)