Skip to content

Commit

Permalink
Add some protection for error during initial genome load
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Feb 5, 2024
1 parent 801acb1 commit d03c667
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ async function main(container, config) {

const igvConfig = config.igvConfig

const igvConfigGenome = igvConfig.genome
if (config.restoreLastGenome) {
try {
const lastGenomeId = localStorage.getItem("genomeID")
Expand Down Expand Up @@ -175,7 +176,19 @@ async function main(container, config) {
}
}

const browser = await igv.createBrowser(container, igvConfig)
// TODO -- fix this hack. We are assuming th eerror is due to the "last genome loaded, it could be anything.
let browser
try {
browser = await igv.createBrowser(container, igvConfig)
} catch (e) {
if(igvConfigGenome !== igvConfig.genome) {
igv.removeAllBrowsers()
igvConfig.genome = igvConfigGenome
browser = await igv.createBrowser(container, igvConfig)
} else {
console.error(e)
}
}

if (browser) {
Globals.browser = browser
Expand Down

0 comments on commit d03c667

Please sign in to comment.