Skip to content

Commit

Permalink
fix: make sure error.config is defined in the errorLogger
Browse files Browse the repository at this point in the history
Sometimes, axios throws an error without `error.config`, this makes sure
we don’t destructure an undefined property.

Related: axios/axios#4665
Fix hg-pyun#94
  • Loading branch information
tusbar committed May 3, 2022
1 parent 9203ad0 commit 30d0d3c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/logger/error.ts
Expand Up @@ -4,6 +4,9 @@ import { assembleBuildConfig } from '../common/config';
import StringBuilder from '../common/string-builder';

function errorLoggerWithoutPromise(error: AxiosError, config: ErrorLogConfig = {}) {
if (!error.config) {
return error
}

const {config: { method, baseURL, params, url }, response} = error;

Expand Down

0 comments on commit 30d0d3c

Please sign in to comment.