Skip to content

Commit

Permalink
fix: Revert regression to the debug logging for axios errors (#1338)
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-yeager authored Jan 14, 2025
1 parent 49b2a42 commit 48e9d58
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/errorHandlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
import { shouldSuppressError } from './suppressError';
import { i18n } from '../lang';
import util from 'util';
import { isAxiosError } from 'axios';

const i18nKey = 'lib.errorHandlers.index';

Expand Down Expand Up @@ -50,10 +51,12 @@ export function debugError(error: unknown, context?: ApiErrorContext): void {
logger.debug(i18n(`${i18nKey}.errorOccurred`, { error: String(error) }));
}

if (error instanceof Error) {
if (error instanceof Error && error.cause) {
logger.debug(
i18n(`${i18nKey}.errorCause`, {
cause: util.inspect(error.cause, false, null, true),
cause: isAxiosError(error.cause)
? `${error.cause}`
: util.inspect(error.cause, false, null, true),
})
);
}
Expand Down

0 comments on commit 48e9d58

Please sign in to comment.