Skip to content

Commit

Permalink
Added title check
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed May 8, 2024
1 parent 4d72c23 commit de1451d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/services/FetchBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ export default class FetchBuilder {
const type = r.headers.get("content-type");
if (/\/json/i.test(type)) {
const json = await r.json();
throw new JsonError(`Failed for ${this.request.url}`, json);
throw new JsonError(json.title
?? json.detail
?? json.message
?? json.exceptionMessage
?? "Json Server Error", json);
}
const text = await r.text();
throw new Error(`Failed for ${this.request.url}\n${text}`);
Expand Down

0 comments on commit de1451d

Please sign in to comment.