Skip to content

Commit

Permalink
don't crash if the server doesn't return valid json
Browse files Browse the repository at this point in the history
  • Loading branch information
bmesuere committed Aug 7, 2024
1 parent 3c54ee1 commit 193284c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/commands/unipept/unipept_subcommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ export abstract class UnipeptSubcommand {
}
});

let result = await r.json();
let result;
try {
result = await r.json();
} catch (e) {
result = [];
}
if (Array.isArray(result) && result.length === 0) return;
result = this.filterResult(result);

Expand Down

0 comments on commit 193284c

Please sign in to comment.