Skip to content

Commit

Permalink
fix: error handling for exceptions for recurrence next
Browse files Browse the repository at this point in the history
Handle exceptions that may happen when resolving recurrence next to an actual recurrence id.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
  • Loading branch information
kesselb committed Sep 19, 2023
1 parent 9b2c4dd commit cc02049
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/mixins/EditorMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,10 +714,19 @@ export default {
const closeToDate = dateFactory()
// TODO: can we replace this by simply returning the new route since we are inside next()
// Probably not though, because it's async
await vm.loadingCalendars()
const recurrenceId = await vm.$store.dispatch('resolveClosestRecurrenceIdForCalendarObject', { objectId, closeToDate })
const params = Object.assign({}, vm.$route.params, { recurrenceId })
vm.$router.replace({ name: vm.$route.name, params })
try {
await vm.loadingCalendars()
const recurrenceId = await vm.$store.dispatch('resolveClosestRecurrenceIdForCalendarObject', { objectId, closeToDate })
const params = Object.assign({}, vm.$route.params, { recurrenceId })
vm.$router.replace({ name: vm.$route.name, params })

Check warning on line 721 in src/mixins/EditorMixin.js

View check run for this annotation

Codecov / codecov/patch

src/mixins/EditorMixin.js#L717-L721

Added lines #L717 - L721 were not covered by tests
} catch (error) {
console.debug(error)
vm.isError = true
vm.error = t('calendar', 'It might have been deleted, or there was a typo in a link')
return // if we cannot resolve next to an actual recurrenceId, return here to avoid further processing.

Check warning on line 726 in src/mixins/EditorMixin.js

View check run for this annotation

Codecov / codecov/patch

src/mixins/EditorMixin.js#L723-L726

Added lines #L723 - L726 were not covered by tests
} finally {
vm.isLoading = false

Check warning on line 728 in src/mixins/EditorMixin.js

View check run for this annotation

Codecov / codecov/patch

src/mixins/EditorMixin.js#L728

Added line #L728 was not covered by tests
}
}

try {
Expand Down

0 comments on commit cc02049

Please sign in to comment.