Skip to content

Commit

Permalink
error handling of file parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr0nox committed Oct 5, 2023
1 parent 09ce05b commit 33aa11b
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 15 deletions.
17 changes: 14 additions & 3 deletions report-viewer/src/viewWrapper/ClusterViewWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { OverviewFactory } from '@/model/factories/OverviewFactory'
import ClusterView from '@/views/ClusterView.vue'
import LoadingCircle from '@/components/LoadingCircle.vue'
import type { Overview } from '@/model/Overview'
import { router } from '@/router'
const props = defineProps({
clusterIndex: {
Expand All @@ -26,7 +27,17 @@ const clusterIndex = computed(() => parseInt(props.clusterIndex))
const overview: Ref<Overview | null> = ref(null)
OverviewFactory.getOverview().then((o) => {
overview.value = o
})
OverviewFactory.getOverview()
.then((o) => {
overview.value = o
})
.catch((error) => {
console.error(error)
router.push({
name: 'ErrorView',
params: {
message: error.message
}
})
})
</script>
33 changes: 27 additions & 6 deletions report-viewer/src/viewWrapper/ComparisonViewWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { getHighlightLanguage, type HighlightLanguage } from '@/model/Language'
import type { Comparison } from '@/model/Comparison'
import { ComparisonFactory } from '@/model/factories/ComparisonFactory'
import LoadingCircle from '@/components/LoadingCircle.vue'
import { router } from '@/router'
const props = defineProps({
firstId: {
Expand All @@ -39,11 +40,31 @@ const language: Ref<HighlightLanguage | null> = ref(null)
// This eslint rule is disabled to allow the use of await in the setup function. Disabling this rule is safe, because the props are gathered from the url, so changing them would reload the pafe anyway.
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
ComparisonFactory.getComparison(props.firstId, props.secondId).then((comp) => {
comparison.value = comp
})
ComparisonFactory.getComparison(props.firstId, props.secondId)
.then((comp) => {
comparison.value = comp
})
.catch((error) => {
console.error(error)
router.push({
name: 'ErrorView',
params: {
message: error.message
}
})
})
OverviewFactory.getOverview().then((overview) => {
language.value = getHighlightLanguage(overview.language)
})
OverviewFactory.getOverview()
.then((overview) => {
language.value = getHighlightLanguage(overview.language)
})
.catch((error) => {
console.error(error)
router.push({
name: 'ErrorView',
params: {
message: error.message
}
})
})
</script>
17 changes: 14 additions & 3 deletions report-viewer/src/viewWrapper/InformationViewWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,21 @@ import { OverviewFactory } from '@/model/factories/OverviewFactory'
import InformationView from '@/views/InformationView.vue'
import type { Overview } from '@/model/Overview'
import LoadingCircle from '@/components/LoadingCircle.vue'
import { router } from '@/router'
const overview: Ref<Overview | null> = ref(null)
OverviewFactory.getOverview().then((o) => {
overview.value = o
})
OverviewFactory.getOverview()
.then((o) => {
overview.value = o
})
.catch((error) => {
console.error(error)
router.push({
name: 'ErrorView',
params: {
message: error.message
}
})
})
</script>
17 changes: 14 additions & 3 deletions report-viewer/src/viewWrapper/OverviewViewWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,21 @@ import { OverviewFactory } from '@/model/factories/OverviewFactory'
import OverviewView from '@/views/OverviewView.vue'
import type { Overview } from '@/model/Overview'
import LoadingCircle from '@/components/LoadingCircle.vue'
import { router } from '@/router'
const overview: Ref<Overview | null> = ref(null)
OverviewFactory.getOverview().then((o) => {
overview.value = o
})
OverviewFactory.getOverview()
.then((o) => {
overview.value = o
})
.catch((error) => {
console.error(error)
router.push({
name: 'ErrorView',
params: {
message: error.message
}
})
})
</script>

0 comments on commit 33aa11b

Please sign in to comment.