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:
parent
6c9ef53ea4
commit
9ea67a74b4
@ -39,7 +39,7 @@ export default abstract class Addon {
|
|||||||
|
|
||||||
async fetchRetry(
|
async fetchRetry(
|
||||||
url: string,
|
url: string,
|
||||||
options = {},
|
options: any = {},
|
||||||
retries: number = 1,
|
retries: number = 1,
|
||||||
): Promise<Response> {
|
): Promise<Response> {
|
||||||
let res;
|
let res;
|
||||||
@ -52,6 +52,13 @@ export default abstract class Addon {
|
|||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
} catch (e) {
|
} 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 };
|
res = { statusCode: e.code, ok: false };
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
Reference in New Issue
Block a user