Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit 41c0d6f

Browse files
exclude webpack config from coverage
1 parent 1fbd05a commit 41c0d6f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

sonar-project.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sonar.tests=.
88
sonar.exclusions=src/serverApi/**/*,**/locales/**.ts
99

1010
# Exclude scripts from root folder, app setup scripts from src and route config from coverage
11-
sonar.coverage.exclusions=/*,src/*,src/router/*,webpack-config/**/*
11+
sonar.coverage.exclusions=/*,src/*,src/router/*,config/**/*
1212

1313
# Include test files and test utils in test scope
1414
sonar.test.inclusions=tests/**/*,**/*.unit.ts,**/*.unit.js

src/utils/api/api.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,23 @@ export const mapAxiosErrorToResponseError = (
3131
Record<string, unknown>
3232
>(error)
3333
) {
34+
if (!error.response) {
35+
return apiError;
36+
}
37+
3438
const errorPayload:
3539
| ApiValidationError
3640
| ApiResponseError
3741
| string
38-
| undefined = error.response?.data;
42+
| undefined = error.response.data;
3943

4044
if (errorPayload && isObject(errorPayload)) {
4145
apiError = errorPayload;
4246
} else if (typeof errorPayload === "string") {
4347
apiError.message = errorPayload;
44-
apiError.code = error.response?.status ?? apiError.code;
48+
apiError.code = error.response.status ?? apiError.code;
4549
apiError.type = error.code ?? apiError.type;
46-
apiError.title = error.response?.statusText ?? apiError.title;
50+
apiError.title = error.response.statusText ?? apiError.title;
4751
}
4852
}
4953
return apiError;

0 commit comments

Comments
 (0)