From 9ea67a74b41a361672436873a34f3360ff4f3bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gast=C3=B3n=20Fournier?= Date: Wed, 11 Jan 2023 09:13:22 +0100 Subject: [PATCH] feat: add error logs for addons (#2739) ## About the changes This uses log-level warning so we can turn off the log without turning off all error logs. This could potentially be tweaked further by using log categories in the log configuration. Closes #2057 --- src/lib/addons/addon.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/addons/addon.ts b/src/lib/addons/addon.ts index e39fb52549..907f31b585 100644 --- a/src/lib/addons/addon.ts +++ b/src/lib/addons/addon.ts @@ -39,7 +39,7 @@ export default abstract class Addon { async fetchRetry( url: string, - options = {}, + options: any = {}, retries: number = 1, ): Promise { let res; @@ -52,6 +52,13 @@ export default abstract class Addon { }); return res; } catch (e) { + const { method } = options; + this.logger.warn( + `Error querying ${url} with method ${ + method || 'GET' + } status code ${e.code}`, + e, + ); res = { statusCode: e.code, ok: false }; } return res;