Skip to content

Commit

Permalink
lib: handle errors on H1 fetch reports
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelGSS committed Sep 24, 2024
1 parent 9224469 commit ec678de
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,13 @@ export default class Request {
Accept: 'application/json'
}
};
return this.json(url, options);
const data = await this.json(url, options);
if (data?.errors) {
throw new Error(
`Request to fetch triaged reports failed with: ${JSON.stringify(data.errors)}`
);
}
return data;
}

async getPrograms() {
Expand Down

0 comments on commit ec678de

Please sign in to comment.