From 193284cc5aab4d7e2160919d5486b3df67b26060 Mon Sep 17 00:00:00 2001 From: Bart Mesuere Date: Wed, 7 Aug 2024 13:43:14 +0200 Subject: [PATCH] don't crash if the server doesn't return valid json --- lib/commands/unipept/unipept_subcommand.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/commands/unipept/unipept_subcommand.ts b/lib/commands/unipept/unipept_subcommand.ts index bd62346d..46be7ffc 100644 --- a/lib/commands/unipept/unipept_subcommand.ts +++ b/lib/commands/unipept/unipept_subcommand.ts @@ -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);