Unverified Commit 99655e4f authored by Andrey Azov's avatar Andrey Azov Committed by GitHub
Browse files

Fail downloading all sequences by InstantDownload if any one fails (#728)

parent 5999a8f4
Pipeline #266357 passed with stages
in 4 minutes and 34 seconds
...@@ -133,8 +133,9 @@ const InstantDownloadGene = (props: Props) => { ...@@ -133,8 +133,9 @@ const InstantDownloadGene = (props: Props) => {
try { try {
await fetchForGene(payload); await fetchForGene(payload);
props.onDownloadSuccess?.(payload); props.onDownloadSuccess?.(payload);
} catch { } catch (error) {
props.onDownloadFailure?.(payload); props.onDownloadFailure?.(payload);
throw error;
} finally { } finally {
resetCheckboxes(); resetCheckboxes();
} }
......
...@@ -149,8 +149,9 @@ const InstantDownloadTranscript = (props: Props) => { ...@@ -149,8 +149,9 @@ const InstantDownloadTranscript = (props: Props) => {
try { try {
await fetchForTranscript(payload); await fetchForTranscript(payload);
props.onDownloadSuccess?.(payload); props.onDownloadSuccess?.(payload);
} catch { } catch (error) {
props.onDownloadFailure?.(payload); props.onDownloadFailure?.(payload);
throw error;
} finally { } finally {
resetCheckboxes(); resetCheckboxes();
} }
......
...@@ -30,7 +30,13 @@ export type SequenceFetcherParams = Array<SingleSequenceFetchParams>; ...@@ -30,7 +30,13 @@ export type SequenceFetcherParams = Array<SingleSequenceFetchParams>;
const downloadSequences = async (params: SequenceFetcherParams) => { const downloadSequences = async (params: SequenceFetcherParams) => {
const sequencePromises = params.map(({ label, url, reverseComplement }) => { const sequencePromises = params.map(({ label, url, reverseComplement }) => {
return fetch(url) return fetch(url)
.then((response) => response.text()) .then((response) => {
if (response.ok) {
return response.text();
} else {
throw new Error();
}
})
.then((sequence) => { .then((sequence) => {
if (reverseComplement) { if (reverseComplement) {
sequence = getReverseComplement(sequence); sequence = getReverseComplement(sequence);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment