1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00

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
This commit is contained in:
Gastón Fournier 2023-01-11 09:13:22 +01:00 committed by GitHub
parent 6c9ef53ea4
commit 9ea67a74b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,7 @@ export default abstract class Addon {
async fetchRetry(
url: string,
options = {},
options: any = {},
retries: number = 1,
): Promise<Response> {
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;