Skip to content

Commit

Permalink
exclude webpack config from coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinOehlerkingCap committed Aug 12, 2024
1 parent 1fbd05a commit 41c0d6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sonar.tests=.
sonar.exclusions=src/serverApi/**/*,**/locales/**.ts

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

# Include test files and test utils in test scope
sonar.test.inclusions=tests/**/*,**/*.unit.ts,**/*.unit.js
Expand Down
10 changes: 7 additions & 3 deletions src/utils/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,23 @@ export const mapAxiosErrorToResponseError = (
Record<string, unknown>
>(error)
) {
if (!error.response) {
return apiError;
}

const errorPayload:
| ApiValidationError
| ApiResponseError
| string
| undefined = error.response?.data;
| undefined = error.response.data;

if (errorPayload && isObject(errorPayload)) {
apiError = errorPayload;
} else if (typeof errorPayload === "string") {
apiError.message = errorPayload;
apiError.code = error.response?.status ?? apiError.code;
apiError.code = error.response.status ?? apiError.code;
apiError.type = error.code ?? apiError.type;
apiError.title = error.response?.statusText ?? apiError.title;
apiError.title = error.response.statusText ?? apiError.title;
}
}
return apiError;
Expand Down

0 comments on commit 41c0d6f

Please sign in to comment.