From 4506d38eac8f61a6b66c4725356b95ba046b0102 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Tue, 27 Aug 2024 21:53:37 +0200 Subject: [PATCH] Replace some ES5-style functions with ES6-style ones --- src/handlers/clientErrorHandler.js | 4 ++-- src/handlers/requestHandler.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/handlers/clientErrorHandler.js b/src/handlers/clientErrorHandler.js index ee85d86..2a44649 100644 --- a/src/handlers/clientErrorHandler.js +++ b/src/handlers/clientErrorHandler.js @@ -183,7 +183,7 @@ function clientErrorHandler(err, socket) { fs.access( "." + errorCode.toString(), fs.constants.F_OK, - function (err) { + (err) => { try { if (err) { callback(errorCode.toString() + ".html"); @@ -207,7 +207,7 @@ function clientErrorHandler(err, socket) { fs.access( "." + errorCode.toString(), fs.constants.F_OK, - function (err) { + (err) => { try { if (err) { callback(errorCode.toString() + ".html"); diff --git a/src/handlers/requestHandler.js b/src/handlers/requestHandler.js index c756ee7..6b8ed30 100644 --- a/src/handlers/requestHandler.js +++ b/src/handlers/requestHandler.js @@ -343,8 +343,8 @@ function requestHandler(req, res) { } // Determine error file - function getErrorFileName(list, callback, _i) { - function medCallback(p) { + const getErrorFileName = (list, callback, _i) => { + const medCallback = (p) => { if (p) callback(p); else { if (errorCode == 404) { @@ -353,7 +353,7 @@ function requestHandler(req, res) { fs.access( "." + errorCode.toString(), fs.constants.F_OK, - function (err) { + (err) => { try { if (err) { callback(errorCode.toString() + ".html"); @@ -377,7 +377,7 @@ function requestHandler(req, res) { fs.access( "." + errorCode.toString(), fs.constants.F_OK, - function (err) { + (err) => { try { if (err) { callback(errorCode.toString() + ".html");