Skip to content

Commit a33de8c

Browse files
committed
feat(issue): improve jira error handling
1 parent 0e892dd commit a33de8c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/app/features/issue/providers/jira/jira-api.service.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,12 @@ export class JiraApiService {
472472
fetch(url, requestInit)
473473
.then((response) => response.body)
474474
.then(streamToJsonIfPossible as any)
475-
.then((res) =>
476-
transform ? transform({ response: res }, jiraCfg) : { response: res },
477-
),
475+
.then((res) => {
476+
if ((res as any)?.errorMessages?.length) {
477+
throw new Error((res as any).errorMessages.join(', '));
478+
}
479+
return transform ? transform({ response: res }, jiraCfg) : { response: res };
480+
}),
478481
).pipe(
479482
catchError((err) => {
480483
console.log(err);

0 commit comments

Comments
 (0)