improved the unloading process to not create a useless socket

This commit is contained in:
kharhamel 2021-03-26 14:12:22 +01:00
parent 30e12702eb
commit 886daebfea
6 changed files with 26 additions and 22 deletions

View file

@ -1,5 +1,4 @@
import {HttpRequest, HttpResponse} from "uWebSockets.js";
import {ADMIN_API_TOKEN} from "../Enum/EnvironmentVariable";
import {HttpResponse} from "uWebSockets.js";
export class BaseController {
@ -14,7 +13,8 @@ export class BaseController {
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
protected errorToResponse(e: any, res: HttpResponse): void {
console.error("An error happened", e);
console.error(e.message || "An error happened.", e?.config.url);
console.error(e.stack || 'no stack defined.');
if (e.response) {
res.writeStatus(e.response.status+" "+e.response.statusText);
this.addCorsHeaders(res);