From de7025c2355ce95d818246f0e72cead2746dce02 Mon Sep 17 00:00:00 2001 From: chee Date: Tue, 17 Nov 2020 20:34:58 +0000 Subject: [PATCH] dont die when listening is hard --- index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f11845f..fef77b1 100644 --- a/index.js +++ b/index.js @@ -82,7 +82,15 @@ async function listen(request, response, name, scope) { send(response, 408, "That took too long! please try again") }) }, 60000) - server.listen(sockPath) + try { + server.listen(sockPath) + } catch (error) { + send( + response, + 500, + "something went wrong trying to listen ,perhaps you are listening on another tab or are the victim of a DoS attack?" + ) + } } async function notfound(request, response) {