From ba21ae60d79e75a4b99883bcd3d9b19216a4eef1 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 18 May 2023 00:26:32 -0700 Subject: [PATCH] url error log --- src/utils/proxy/handlers/generic.js | 9 ++++++++- src/utils/proxy/http.js | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/utils/proxy/handlers/generic.js b/src/utils/proxy/handlers/generic.js index 8e31c5569..a2077b91d 100644 --- a/src/utils/proxy/handlers/generic.js +++ b/src/utils/proxy/handlers/generic.js @@ -57,7 +57,14 @@ export default async function genericProxyHandler(req, res, map) { } if (status >= 400) { - logger.debug("HTTP Error %d calling %s//%s%s%s...", status, url.protocol, url.hostname, url.port, url.pathname); + logger.debug( + "HTTP Error %d calling %s//%s:%s%s...", + status, + url.protocol, + url.hostname, + url.port, + url.pathname + ); return res.status(status).json({error: {message: "HTTP Error", url: sanitizeErrorURL(url), resultData}}); } diff --git a/src/utils/proxy/http.js b/src/utils/proxy/http.js index 9b21fe7de..1df0f5772 100644 --- a/src/utils/proxy/http.js +++ b/src/utils/proxy/http.js @@ -81,7 +81,13 @@ export async function httpProxy(url, params = {}) { return [status, contentType, data, responseHeaders]; } catch (err) { - logger.error("Error calling %s//%s:%s%s...", constructedUrl.protocol, constructedUrl.hostname, constructedUrl.port, constructedUrl.pathname); + logger.error( + "Error calling %s//%s:%s%s...", + constructedUrl.protocol, + constructedUrl.hostname, + constructedUrl.port, + constructedUrl.pathname + ); logger.error(err); return [500, "application/json", { error: {message: err?.message ?? "Unknown error", url, rawError: err} }, null]; }