Skip to content

Commit

Permalink
Fix: no error message when viewer can't load the file
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjelonek committed Dec 3, 2024
1 parent 05bbf07 commit a389fe9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/pages/show-own-result-file/ShowOwnResultPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
accept=".json"
/>
</div>
<notification :message="error" />
<notification type="danger" :message="error" />
<progress-bar
v-if="loadingProgress.enabled"
:progress="loadingProgress"
:title="loadingProgress.title"
/>

<div v-if="!loadingProgress.enabled && !error && data">
<div v-if="!loadingProgress.enabled && data">
<div class="mt-5">
<h4>Job statistics</h4>
<div class="" id="stats">
Expand Down Expand Up @@ -91,6 +91,7 @@ function jsonFileChanged(evt: Event) {
}
function loadData(file: File) {
error.value = undefined
loadingProgress.value.enabled = true
loadingProgress.value.value = 0
loadingProgress.value.title = 'Processing data. This may take a while for larger genomes.'
Expand All @@ -102,9 +103,14 @@ function loadData(file: File) {
setError('Loading data failed')
return
}
const json = JSON.parse(event.target.result)
const parsed = parseBaktaData(json)
data.value = parsed
try {
const json = JSON.parse(event.target.result)
const parsed = parseBaktaData(json)
data.value = parsed
} catch (err) {
console.error(err)
setError('The provided file output is not supported')
}
loadingProgress.value.enabled = false
}
reader.readAsText(file)
Expand Down

0 comments on commit a389fe9

Please sign in to comment.