Skip to content

Commit

Permalink
feat: adding more details to error log line when http request fails (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
artursudnik committed Jul 22, 2022
1 parent 650b765 commit e99ceda
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/modules/cache-client/cache-client.service.ts
Expand Up @@ -594,7 +594,22 @@ export class CacheClient implements ICacheClient {
return false;
}

getLogger().debug(`[CACHE CLIENT] axios error: ${error.message}`);
const errorDetails = {
message: error.message,
url: error.config.url,
method: error.config.method,
requestHeaders: {
...error.config.headers,
Authorization: error.config.headers?.Authorization ? '***' : undefined,
},
status: error.response?.status,
statusText: error.response?.statusText,
responseHeaders: error.response?.headers,
};

getLogger().debug(
`[CACHE CLIENT] axios error: ${JSON.stringify(errorDetails)}`
);
const { config, response } = error;

if (!response) {
Expand Down

0 comments on commit e99ceda

Please sign in to comment.