Skip to content

Commit

Permalink
Check for unfilled form entry items
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 2, 2021
1 parent 559cb11 commit d99b67f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions products/jbrowse-desktop/src/OpenSequenceDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ function AdapterInput({

const blank = { uri: '' } as FileLocation

function isBlank(location: FileLocation) {
return 'uri' in location && location.uri === ''
}

const OpenSequenceDialog = ({
onClose,
}: {
Expand Down Expand Up @@ -183,6 +187,9 @@ const OpenSequenceDialog = ({
}
}
if (adapterSelection === 'IndexedFastaAdapter') {
if (isBlank(fastaLocation) || isBlank(faiLocation)) {
throw new Error('Need both fastaLocation and faiLocation')
}
return {
name: assemblyName,
displayName: assemblyDisplayName,
Expand All @@ -195,6 +202,15 @@ const OpenSequenceDialog = ({
},
}
} else if (adapterSelection === 'BgzipFastaAdapter') {
if (
isBlank(fastaLocation) ||
isBlank(faiLocation) ||
isBlank(gziLocation)
) {
throw new Error(
'Need both fastaLocation and faiLocation and gziLocation',
)
}
return {
name: assemblyName,
displayName: assemblyDisplayName,
Expand All @@ -208,6 +224,9 @@ const OpenSequenceDialog = ({
},
}
} else if (adapterSelection === 'TwoBitAdapter') {
if (isBlank(twoBitLocation)) {
throw new Error('Need twoBitLocation')
}
return {
name: assemblyName,
displayName: assemblyDisplayName,
Expand Down

0 comments on commit d99b67f

Please sign in to comment.