From 3b940cb56c2e29f83b5b329dea45f6059be7ca48 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Sat, 9 Oct 2021 16:04:19 +0200 Subject: [PATCH] feat: don't rethrow same error and handle errors globally --- src/App.vue | 1 - src/components/home/contentAuth.vue | 3 -- src/components/home/navigation.vue | 4 -- src/components/list/partials/filters.vue | 4 -- src/components/list/partials/list-card.vue | 4 -- src/components/migrator/migration.vue | 12 ------ src/components/misc/subscription.vue | 6 --- .../notifications/notifications.vue | 4 -- .../quick-actions/quick-actions.vue | 12 ------ src/components/sharing/linkSharing.vue | 9 ---- src/components/sharing/userTeam.vue | 15 ------- src/components/tasks/add-task.vue | 6 +-- src/components/tasks/edit-task.vue | 3 -- src/components/tasks/gantt-component.vue | 12 ------ src/components/tasks/mixins/taskList.js | 3 -- src/components/tasks/partials/attachments.vue | 3 -- src/components/tasks/partials/comments.vue | 12 ------ src/components/tasks/partials/defer-task.vue | 3 -- src/components/tasks/partials/description.vue | 3 -- .../tasks/partials/editAssignees.vue | 9 ---- src/components/tasks/partials/editLabels.vue | 9 ---- src/components/tasks/partials/heading.vue | 3 -- src/components/tasks/partials/kanban-card.vue | 3 -- src/components/tasks/partials/listSearch.vue | 3 -- .../tasks/partials/relatedTasks.vue | 19 +------- .../tasks/partials/singleTaskInList.vue | 6 --- src/components/user/avatar-settings.vue | 11 ++--- src/components/user/settings/data-export.vue | 1 - src/components/user/settings/deletion.vue | 2 - src/helpers/auth.ts | 4 +- src/helpers/migrator.ts | 2 +- src/main.ts | 22 +++++++++- src/services/abstractService.js | 43 +++---------------- src/services/backgroundUnsplash.js | 3 -- src/services/list.js | 10 +---- src/services/passwordReset.js | 6 --- src/store/modules/auth.js | 9 +--- src/store/modules/config.js | 1 - src/store/modules/kanban.js | 32 +++----------- src/store/modules/labels.js | 4 -- src/store/modules/lists.js | 6 +-- src/store/modules/namespaces.js | 3 -- src/store/modules/tasks.js | 37 +++------------- src/views/filters/CreateSavedFilter.vue | 1 - src/views/filters/settings/delete.vue | 1 - src/views/filters/settings/edit.vue | 2 - src/views/labels/ListLabels.vue | 9 ---- src/views/labels/NewLabel.vue | 3 -- src/views/list/NewList.vue | 3 -- src/views/list/ShowList.vue | 3 -- src/views/list/settings/archive.vue | 3 -- src/views/list/settings/background.vue | 12 ------ src/views/list/settings/delete.vue | 3 -- src/views/list/settings/duplicate.vue | 3 -- src/views/list/settings/edit.vue | 6 --- src/views/list/settings/share.vue | 3 -- src/views/list/views/Kanban.vue | 1 - src/views/list/views/List.vue | 3 -- src/views/namespaces/NewNamespace.vue | 3 -- src/views/namespaces/settings/archive.vue | 3 -- src/views/namespaces/settings/delete.vue | 3 -- src/views/namespaces/settings/edit.vue | 6 --- src/views/namespaces/settings/share.vue | 3 -- src/views/tasks/ShowTasks.vue | 3 -- src/views/tasks/TaskDetailView.vue | 39 ++++++----------- src/views/teams/EditTeam.vue | 21 --------- src/views/teams/ListTeams.vue | 3 -- src/views/teams/NewTeam.vue | 3 -- src/views/user/DataExportDownload.vue | 1 - src/views/user/Register.vue | 1 - src/views/user/Settings.vue | 8 +--- 71 files changed, 69 insertions(+), 451 deletions(-) diff --git a/src/App.vue b/src/App.vue index 90231eb0..79c9f433 100644 --- a/src/App.vue +++ b/src/App.vue @@ -109,7 +109,6 @@ export default defineComponent({ this.$message.success({message: this.$t('user.deletion.confirmSuccess')}) this.$store.dispatch('auth/refreshUserInfo') }) - .catch(e => this.$message.error(e)) } }, }, diff --git a/src/components/home/contentAuth.vue b/src/components/home/contentAuth.vue index ff055830..b4b6c527 100644 --- a/src/components/home/contentAuth.vue +++ b/src/components/home/contentAuth.vue @@ -128,9 +128,6 @@ export default { }, loadLabels() { this.$store.dispatch('labels/loadAllLabels') - .catch(e => { - this.$message.error(e) - }) }, }, } diff --git a/src/components/home/navigation.vue b/src/components/home/navigation.vue index 44a3c9a0..4e874f2d 100644 --- a/src/components/home/navigation.vue +++ b/src/components/home/navigation.vue @@ -218,7 +218,6 @@ export default { return } this.$store.dispatch('lists/toggleListFavorite', list) - .catch(e => this.$message.error(e)) }, resize() { // Hide the menu by default on mobile @@ -263,9 +262,6 @@ export default { ...list, position, }) - .catch(e => { - this.$message.error(e) - }) .finally(() => { this.listUpdating[list.id] = false }) diff --git a/src/components/list/partials/filters.vue b/src/components/list/partials/filters.vue index e27cee12..a9175e98 100644 --- a/src/components/list/partials/filters.vue +++ b/src/components/list/partials/filters.vue @@ -483,7 +483,6 @@ export default { .then(r => { this[kind] = r }) - .catch(e => this.$message.error(e)) } }, setDoneFilter() { @@ -535,9 +534,6 @@ export default { // Filter users from the results who are already assigned this[`found${kind}`] = response.filter(({id}) => !includesById(this[kind], id)) }) - .catch(e => { - this.$message.error(e) - }) }, add(kind, filterName) { this.$nextTick(() => { diff --git a/src/components/list/partials/list-card.vue b/src/components/list/partials/list-card.vue index 09be012a..c351fb2a 100644 --- a/src/components/list/partials/list-card.vue +++ b/src/components/list/partials/list-card.vue @@ -68,9 +68,6 @@ export default { .then(b => { this.background = b }) - .catch(e => { - this.$message.error(e) - }) .finally(() => this.backgroundLoading = false) }, toggleFavoriteList(list) { @@ -80,7 +77,6 @@ export default { return } this.$store.dispatch('lists/toggleListFavorite', list) - .catch(e => this.$message.error(e)) }, }, } diff --git a/src/components/migrator/migration.vue b/src/components/migrator/migration.vue index 9846f7ef..57a3cab5 100644 --- a/src/components/migrator/migration.vue +++ b/src/components/migrator/migration.vue @@ -138,9 +138,6 @@ export default { } this.migrate() }) - .catch(e => { - this.$message.error(e) - }) } }, methods: { @@ -149,9 +146,6 @@ export default { .then(r => { this.authUrl = r.url }) - .catch(e => { - this.$message.error(e) - }) }, migrate() { this.isMigrating = true @@ -167,9 +161,6 @@ export default { this.message = r.message this.$store.dispatch('namespaces/loadNamespaces') }) - .catch(e => { - this.$message.error(e) - }) .finally(() => { this.isMigrating = false }) @@ -184,9 +175,6 @@ export default { this.message = r.message this.$store.dispatch('namespaces/loadNamespaces') }) - .catch(e => { - this.$message.error(e) - }) .finally(() => { this.isMigrating = false }) diff --git a/src/components/misc/subscription.vue b/src/components/misc/subscription.vue index f29091c6..adbc8826 100644 --- a/src/components/misc/subscription.vue +++ b/src/components/misc/subscription.vue @@ -99,9 +99,6 @@ export default { this.$emit('change', subscription) this.$message.success({message: this.$t('task.subscription.subscribeSuccess', {entity: this.entity})}) }) - .catch(e => { - this.$message.error(e) - }) }, unsubscribe() { const subscription = new SubscriptionModel({ @@ -113,9 +110,6 @@ export default { this.$emit('change', null) this.$message.success({message: this.$t('task.subscription.unsubscribeSuccess', {entity: this.entity})}) }) - .catch(e => { - this.$message.error(e) - }) }, }, } diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue index 0fb3d4c6..a99e0779 100644 --- a/src/components/notifications/notifications.vue +++ b/src/components/notifications/notifications.vue @@ -98,9 +98,6 @@ export default { .then(r => { this.allNotifications = r }) - .catch(e => { - this.$message.error(e) - }) }, to(n, index) { const to = { @@ -137,7 +134,6 @@ export default { .then(r => { this.allNotifications[index] = r }) - .catch(e => this.$message.error(e)) } }, }, diff --git a/src/components/quick-actions/quick-actions.vue b/src/components/quick-actions/quick-actions.vue index 5ed2fa1b..22572a6c 100644 --- a/src/components/quick-actions/quick-actions.vue +++ b/src/components/quick-actions/quick-actions.vue @@ -392,9 +392,6 @@ export default { this.$router.push({name: 'task.detail', params: {id: r.id}}) this.closeQuickActions() }) - .catch((e) => { - this.$message.error(e) - }) }, newList() { if (this.currentList === null) { @@ -411,9 +408,6 @@ export default { this.$router.push({name: 'list.index', params: {listId: r.id}}) this.closeQuickActions() }) - .catch((e) => { - this.$message.error(e) - }) }, newNamespace() { const newNamespace = new NamespaceModel({title: this.query}) @@ -423,9 +417,6 @@ export default { this.$message.success({message: this.$t('namespace.create.success')}) this.closeQuickActions() }) - .catch((e) => { - this.$message.error(e) - }) }, newTeam() { const newTeam = new TeamModel({name: this.query}) @@ -438,9 +429,6 @@ export default { this.$message.success({message: this.$t('team.create.success')}) this.closeQuickActions() }) - .catch((e) => { - this.$message.error(e) - }) }, select(parentIndex, index) { diff --git a/src/components/sharing/linkSharing.vue b/src/components/sharing/linkSharing.vue index cbebea28..78113156 100644 --- a/src/components/sharing/linkSharing.vue +++ b/src/components/sharing/linkSharing.vue @@ -226,9 +226,6 @@ export default { .then((r) => { this.linkShares = r }) - .catch((e) => { - this.$message.error(e) - }) }, add(listId) { const newLinkShare = new LinkShareModel({ @@ -247,9 +244,6 @@ export default { this.$message.success({message: this.$t('list.share.links.createSuccess')}) this.load(listId) }) - .catch((e) => { - this.$message.error(e) - }) }, remove(listId) { const linkshare = new LinkShareModel({ @@ -262,9 +256,6 @@ export default { this.$message.success({message: this.$t('list.share.links.deleteSuccess')}) this.load(listId) }) - .catch((e) => { - this.$message.error(e) - }) .finally(() => { this.showDeleteModal = false }) diff --git a/src/components/sharing/userTeam.vue b/src/components/sharing/userTeam.vue index 66bd524f..91d7ca8f 100644 --- a/src/components/sharing/userTeam.vue +++ b/src/components/sharing/userTeam.vue @@ -281,9 +281,6 @@ export default { this.selectedRight[s.id] = s.right, ) }) - .catch((e) => { - this.$message.error(e) - }) }, deleteSharable() { if (this.shareType === 'user') { @@ -306,9 +303,6 @@ export default { } this.$message.success({message: this.$t('list.share.userTeam.removeSuccess', {type: this.shareTypeName, sharable: this.sharableName})}) }) - .catch((e) => { - this.$message.error(e) - }) }, add(admin) { if (admin === null) { @@ -331,9 +325,6 @@ export default { this.$message.success({message: this.$t('list.share.userTeam.addedSuccess', {type: this.shareTypeName})}) this.load() }) - .catch((e) => { - this.$message.error(e) - }) }, toggleType(sharable) { if ( @@ -367,9 +358,6 @@ export default { } this.$message.success({message: this.$t('list.share.userTeam.updatedSuccess', {type: this.shareTypeName})}) }) - .catch((e) => { - this.$message.error(e) - }) }, find(query) { if (query === '') { @@ -382,9 +370,6 @@ export default { .then((response) => { this.found = response }) - .catch((e) => { - this.$message.error(e) - }) }, clearAll() { this.found = [] diff --git a/src/components/tasks/add-task.vue b/src/components/tasks/add-task.vue index ade0ea76..99d1a950 100644 --- a/src/components/tasks/add-task.vue +++ b/src/components/tasks/add-task.vue @@ -113,16 +113,16 @@ export default { ) }) - Promise.all(newTasks) + return Promise.all(newTasks) .then(() => { this.newTaskTitle = '' }) .catch(e => { - if (e === 'NO_LIST') { + if (e.message === 'NO_LIST') { this.errorMessage = this.$t('list.create.addListRequired') return } - this.$message.error(e) + throw e }) }, handleEnter(e) { diff --git a/src/components/tasks/edit-task.vue b/src/components/tasks/edit-task.vue index dc92cfba..61926133 100644 --- a/src/components/tasks/edit-task.vue +++ b/src/components/tasks/edit-task.vue @@ -142,9 +142,6 @@ export default { this.initTaskFields() this.$message.success({message: this.$t('task.detail.updateSuccess')}) }) - .catch((e) => { - this.$message.error(e) - }) }, }, } diff --git a/src/components/tasks/gantt-component.vue b/src/components/tasks/gantt-component.vue index 2ea3591f..1e3825ba 100644 --- a/src/components/tasks/gantt-component.vue +++ b/src/components/tasks/gantt-component.vue @@ -317,9 +317,6 @@ export default { return tasks } }) - .catch((e) => { - return Promise.reject(e) - }) } getAllTasks() @@ -343,9 +340,6 @@ export default { return 0 }) }) - .catch((e) => { - this.$message.error(e) - }) }, addGantAttributes(t) { if (typeof t.durationDays !== 'undefined' && typeof t.offsetDays !== 'undefined') { @@ -423,9 +417,6 @@ export default { } } }) - .catch((e) => { - this.$message.error(e) - }) }, editTask(task) { this.taskToEdit = task @@ -460,9 +451,6 @@ export default { this.newTaskTitle = '' this.hideCrateNewTask() }) - .catch((e) => { - this.$message.error(e) - }) }, formatYear(date) { return this.format(date, 'MMMM, yyyy') diff --git a/src/components/tasks/mixins/taskList.js b/src/components/tasks/mixins/taskList.js index 130e9390..da120b19 100644 --- a/src/components/tasks/mixins/taskList.js +++ b/src/components/tasks/mixins/taskList.js @@ -84,9 +84,6 @@ export default { this.loadedList = JSON.parse(JSON.stringify(currentList)) }) - .catch(e => { - this.$message.error(e) - }) }, loadTasksForPage(e) { diff --git a/src/components/tasks/partials/attachments.vue b/src/components/tasks/partials/attachments.vue index a641a819..de3c8c6a 100644 --- a/src/components/tasks/partials/attachments.vue +++ b/src/components/tasks/partials/attachments.vue @@ -228,9 +228,6 @@ export default { ) this.$message.success(r) }) - .catch((e) => { - this.$message.error(e) - }) .finally(() => { this.showDeleteModal = false }) diff --git a/src/components/tasks/partials/comments.vue b/src/components/tasks/partials/comments.vue index b217ea10..136832e4 100644 --- a/src/components/tasks/partials/comments.vue +++ b/src/components/tasks/partials/comments.vue @@ -227,9 +227,6 @@ export default { this.comments = r this.makeActions() }) - .catch((e) => { - this.$message.error(e) - }) }, addComment() { if (this.newComment.comment === '') { @@ -253,9 +250,6 @@ export default { this.$message.success({message: this.$t('task.comment.addedSuccess')}) this.makeActions() }) - .catch((e) => { - this.$message.error(e) - }) .finally(() => { this.creating = false }) @@ -289,9 +283,6 @@ export default { this.saved = null }, 2000) }) - .catch((e) => { - this.$message.error(e) - }) .finally(() => { this.isCommentEdit = false this.saving = null @@ -307,9 +298,6 @@ export default { } } }) - .catch((e) => { - this.$message.error(e) - }) .finally(() => { this.showDeleteModal = false }) diff --git a/src/components/tasks/partials/defer-task.vue b/src/components/tasks/partials/defer-task.vue index 2e66b501..549c3367 100644 --- a/src/components/tasks/partials/defer-task.vue +++ b/src/components/tasks/partials/defer-task.vue @@ -129,9 +129,6 @@ export default { this.task = r this.$emit('update:modelValue', r) }) - .catch((e) => { - this.$message.error(e) - }) }, }, } diff --git a/src/components/tasks/partials/description.vue b/src/components/tasks/partials/description.vue index fe721158..18ccbfe0 100644 --- a/src/components/tasks/partials/description.vue +++ b/src/components/tasks/partials/description.vue @@ -83,9 +83,6 @@ export default { this.saved = false }, 2000) }) - .catch(e => { - this.$message.error(e) - }) .finally(() => { this.saving = false }) diff --git a/src/components/tasks/partials/editAssignees.vue b/src/components/tasks/partials/editAssignees.vue index 17ecc0db..563735ab 100644 --- a/src/components/tasks/partials/editAssignees.vue +++ b/src/components/tasks/partials/editAssignees.vue @@ -84,9 +84,6 @@ export default { this.$emit('update:modelValue', this.assignees) this.$message.success({message: this.$t('task.assignee.assignSuccess')}) }) - .catch(e => { - this.$message.error(e) - }) }, removeAssignee(user) { this.$store.dispatch('tasks/removeAssignee', {user: user, taskId: this.taskId}) @@ -99,9 +96,6 @@ export default { } this.$message.success({message: this.$t('task.assignee.unassignSuccess')}) }) - .catch(e => { - this.$message.error(e) - }) }, findUser(query) { if (query === '') { @@ -114,9 +108,6 @@ export default { // Filter the results to not include users who are already assigned this.foundUsers = response.filter(({id}) => !includesById(this.assignees, id)) }) - .catch(e => { - this.$message.error(e) - }) }, clearAllFoundUsers() { this.foundUsers = [] diff --git a/src/components/tasks/partials/editLabels.vue b/src/components/tasks/partials/editLabels.vue index 41cf01c0..dd2e10da 100644 --- a/src/components/tasks/partials/editLabels.vue +++ b/src/components/tasks/partials/editLabels.vue @@ -111,9 +111,6 @@ export default { this.$message.success({message: this.$t('task.label.addSuccess')}) } }) - .catch(e => { - this.$message.error(e) - }) }, removeLabel(label) { const removeFromState = () => { @@ -136,9 +133,6 @@ export default { removeFromState() this.$message.success({message: this.$t('task.label.removeSuccess')}) }) - .catch(e => { - this.$message.error(e) - }) }, createAndAddLabel(title) { if (this.taskId === 0) { @@ -152,9 +146,6 @@ export default { this.labels.push(r) this.$message.success({message: this.$t('task.label.addCreateSuccess')}) }) - .catch(e => { - this.$message.error(e) - }) }, }, diff --git a/src/components/tasks/partials/heading.vue b/src/components/tasks/partials/heading.vue index 55f86f58..e775fb8c 100644 --- a/src/components/tasks/partials/heading.vue +++ b/src/components/tasks/partials/heading.vue @@ -82,9 +82,6 @@ export default { this.showSavedMessage = false }, 2000) }) - .catch(e => { - this.$message.error(e) - }) .finally(() => { this.saving = false }) diff --git a/src/components/tasks/partials/kanban-card.vue b/src/components/tasks/partials/kanban-card.vue index e7e30694..0d9141da 100644 --- a/src/components/tasks/partials/kanban-card.vue +++ b/src/components/tasks/partials/kanban-card.vue @@ -104,9 +104,6 @@ export default { playPop() } }) - .catch(e => { - this.$message.error(e) - }) .finally(() => { this.loadingInternal = false }) diff --git a/src/components/tasks/partials/listSearch.vue b/src/components/tasks/partials/listSearch.vue index 14f61b64..fe7a7437 100644 --- a/src/components/tasks/partials/listSearch.vue +++ b/src/components/tasks/partials/listSearch.vue @@ -60,9 +60,6 @@ export default { .then(response => { this.foundLists = response }) - .catch(e => { - this.$message.error(e) - }) }, clearAll() { this.foundLists = [] diff --git a/src/components/tasks/partials/relatedTasks.vue b/src/components/tasks/partials/relatedTasks.vue index dad4072e..5744ef5f 100644 --- a/src/components/tasks/partials/relatedTasks.vue +++ b/src/components/tasks/partials/relatedTasks.vue @@ -185,14 +185,8 @@ export default { }, }, methods: { - findTasks(query) { - this.taskService.getAll({}, {s: query}) - .then(response => { - this.foundTasks = response - }) - .catch(e => { - this.$message.error(e) - }) + async findTasks(query) { + this.foundTasks = await this.taskService.getAll({}, {s: query}) }, addTaskRelation() { let rel = new TaskRelationModel({ @@ -213,9 +207,6 @@ export default { this.saved = false }, 2000) }) - .catch(e => { - this.$message.error(e) - }) }, removeTaskRelation() { const rel = new TaskRelationModel({ @@ -237,9 +228,6 @@ export default { this.saved = false }, 2000) }) - .catch(e => { - this.$message.error(e) - }) .finally(() => { this.showDeleteModal = false }) @@ -251,9 +239,6 @@ export default { this.newTaskRelationTask = r this.addTaskRelation() }) - .catch(e => { - this.$message.error(e) - }) }, relationKindTitle(kind, length) { return this.$tc(`task.relation.kinds.${kind}`, length) diff --git a/src/components/tasks/partials/singleTaskInList.vue b/src/components/tasks/partials/singleTaskInList.vue index d2d21129..5cd7c614 100644 --- a/src/components/tasks/partials/singleTaskInList.vue +++ b/src/components/tasks/partials/singleTaskInList.vue @@ -187,9 +187,6 @@ export default { }, }]) }) - .catch(e => { - this.$message.error(e) - }) } if (checked) { @@ -206,9 +203,6 @@ export default { this.$emit('task-updated', t) this.$store.dispatch('namespaces/loadNamespacesIfFavoritesDontExist') }) - .catch(e => { - this.$message.error(e) - }) }, hideDeferDueDatePopup(e) { if (this.showDefer) { diff --git a/src/components/user/avatar-settings.vue b/src/components/user/avatar-settings.vue index 8fb03565..cdc8a83a 100644 --- a/src/components/user/avatar-settings.vue +++ b/src/components/user/avatar-settings.vue @@ -87,12 +87,9 @@ export default { Cropper, }, methods: { - avatarStatus() { - this.avatarService.get({}) - .then(r => { - this.avatarProvider = r.avatarProvider - }) - .catch(e => this.$message.error(e)) + async avatarStatus() { + const { avatarProvider } = await this.avatarService.get({}) + this.avatarProvider = avatarProvider }, updateAvatarStatus() { const avatarStatus = new AvatarModel({avatarProvider: this.avatarProvider}) @@ -101,7 +98,6 @@ export default { this.$message.success({message: this.$t('user.settings.avatar.statusUpdateSuccess')}) this.$store.commit('auth/reloadAvatar') }) - .catch(e => this.$message.error(e)) }, uploadAvatar() { this.loading = true @@ -114,7 +110,6 @@ export default { this.$message.success({message: this.$t('user.settings.avatar.setSuccess')}) this.$store.commit('auth/reloadAvatar') }) - .catch(e => this.$message.error(e)) .finally(() => { this.loading = false this.isCropAvatar = false diff --git a/src/components/user/settings/data-export.vue b/src/components/user/settings/data-export.vue index 3060d038..e395e6ac 100644 --- a/src/components/user/settings/data-export.vue +++ b/src/components/user/settings/data-export.vue @@ -64,7 +64,6 @@ export default { this.$message.success({message: this.$t('user.export.success')}) this.password = '' }) - .catch(e => this.$message.error(e)) }, }, } diff --git a/src/components/user/settings/deletion.vue b/src/components/user/settings/deletion.vue index a769d737..40dd272b 100644 --- a/src/components/user/settings/deletion.vue +++ b/src/components/user/settings/deletion.vue @@ -113,7 +113,6 @@ export default { this.$message.success({message: this.$t('user.deletion.requestSuccess')}) this.password = '' }) - .catch(e => this.$message.error(e)) }, cancelDeletion() { if (this.password === '') { @@ -128,7 +127,6 @@ export default { this.$store.dispatch('auth/refreshUserInfo') this.password = '' }) - .catch(e => this.$message.error(e)) }, }, } diff --git a/src/helpers/auth.ts b/src/helpers/auth.ts index 53444ff1..60a5f70b 100644 --- a/src/helpers/auth.ts +++ b/src/helpers/auth.ts @@ -53,9 +53,7 @@ export const refreshToken = (persist: boolean): Promise => { return Promise.resolve(r) }) .catch(e => { - // eslint-disable-next-line - console.log('Error renewing token: ', e) - return Promise.reject(e) + throw new Error('Error renewing token: ', { cause: e }) }) } diff --git a/src/helpers/migrator.ts b/src/helpers/migrator.ts index 7949ab69..92106b76 100644 --- a/src/helpers/migrator.ts +++ b/src/helpers/migrator.ts @@ -33,7 +33,7 @@ export const getMigratorFromSlug = (slug: string): Migrator => { isFileMigrator: true, } default: - throw Error('Unknown migrator slug ' + slug) + throw new Error('Unknown migrator slug ' + slug) } } diff --git a/src/main.ts b/src/main.ts index 179446a0..d92234ca 100644 --- a/src/main.ts +++ b/src/main.ts @@ -96,10 +96,30 @@ app.config.errorHandler = (err, vm, info) => { // if (import.meta.env.PROD) { // error(err) // } else { - console.error(err, vm, info) + // console.error(err, vm, info) + error(err) // } } +if (import.meta.env.DEV) { + app.config.warnHandler = (msg, vm, info) => { + error(msg) + } +} + + +// https://stackoverflow.com/a/52076738/15522256 +window.addEventListener('error', (err) => { + error(err) +}) + + +window.addEventListener('unhandledrejection', (err) => { + // event.promise contains the promise object + // event.reason contains the reason for the rejection + error(err) +}) + app.config.globalProperties.$message = { error, success, diff --git a/src/services/abstractService.js b/src/services/abstractService.js index 0aef3c37..f61a337d 100644 --- a/src/services/abstractService.js +++ b/src/services/abstractService.js @@ -105,19 +105,6 @@ export default class AbstractService { return true } - ///////////////////// - // Global error handler - /////////////////// - - /** - * Handles the error and rejects the promise. - * @param error - * @returns {Promise} - */ - errorHandler(error) { - return Promise.reject(error) - } - ///////////////// // Helper functions /////////////// @@ -284,7 +271,7 @@ export default class AbstractService { */ get(model, params = {}) { if (this.paths.get === '') { - return Promise.reject({message: 'This model is not able to get data.'}) + throw new Error('This model is not able to get data.') } return this.getM(this.paths.get, model, params) @@ -304,10 +291,7 @@ export default class AbstractService { model = this.beforeGet(model) const finalUrl = this.getReplacedRoute(url, model) - return this.http.get(finalUrl, {params: params}) - .catch(error => { - return this.errorHandler(error) - }) + return this.http.get(finalUrl, {params}) .then(response => { const result = this.modelGetFactory(response.data) result.maxRight = Number(response.headers['x-max-right']) @@ -339,7 +323,7 @@ export default class AbstractService { */ getAll(model = {}, params = {}, page = 1) { if (this.paths.getAll === '') { - return Promise.reject({message: 'This model is not able to get data.'}) + throw new Error('This model is not able to get data.') } params.page = page @@ -349,9 +333,6 @@ export default class AbstractService { const finalUrl = this.getReplacedRoute(this.paths.getAll, model) return this.http.get(finalUrl, {params: params}) - .catch(error => { - return this.errorHandler(error) - }) .then(response => { this.resultCount = Number(response.headers['x-pagination-result-count']) this.totalPages = Number(response.headers['x-pagination-total-pages']) @@ -378,16 +359,13 @@ export default class AbstractService { */ create(model) { if (this.paths.create === '') { - return Promise.reject({message: 'This model is not able to create data.'}) + throw new Error('This model is not able to create data.') } const cancel = this.setLoading() const finalUrl = this.getReplacedRoute(this.paths.create, model) return this.http.put(finalUrl, model) - .catch(error => { - return this.errorHandler(error) - }) .then(response => { const result = this.modelCreateFactory(response.data) if (typeof model.maxRight !== 'undefined') { @@ -411,9 +389,6 @@ export default class AbstractService { const cancel = this.setLoading() return this.http.post(url, model) - .catch(error => { - return this.errorHandler(error) - }) .then(response => { const result = this.modelUpdateFactory(response.data) if (typeof model.maxRight !== 'undefined') { @@ -433,7 +408,7 @@ export default class AbstractService { */ update(model) { if (this.paths.update === '') { - return Promise.reject({message: 'This model is not able to update data.'}) + throw new Error('This model is not able to update data.') } const finalUrl = this.getReplacedRoute(this.paths.update, model) @@ -447,16 +422,13 @@ export default class AbstractService { */ delete(model) { if (this.paths.delete === '') { - return Promise.reject({message: 'This model is not able to delete data.'}) + throw new Error('This model is not able to delete data.') } const cancel = this.setLoading() const finalUrl = this.getReplacedRoute(this.paths.delete, model) return this.http.delete(finalUrl, model) - .catch(error => { - return this.errorHandler(error) - }) .then(response => { return Promise.resolve(response.data) }) @@ -513,9 +485,6 @@ export default class AbstractService { }, }, ) - .catch(error => { - return this.errorHandler(error) - }) .then(response => { return Promise.resolve(this.modelCreateFactory(response.data)) }) diff --git a/src/services/backgroundUnsplash.js b/src/services/backgroundUnsplash.js index f0d29645..40161fe2 100644 --- a/src/services/backgroundUnsplash.js +++ b/src/services/backgroundUnsplash.js @@ -27,8 +27,5 @@ export default class BackgroundUnsplashService extends AbstractService { .then(response => { return window.URL.createObjectURL(new Blob([response.data])) }) - .catch(e => { - return e - }) } } \ No newline at end of file diff --git a/src/services/list.js b/src/services/list.js index 5fd2fc3d..b720df9f 100644 --- a/src/services/list.js +++ b/src/services/list.js @@ -57,21 +57,13 @@ export default class ListService extends AbstractService { .then(response => { return window.URL.createObjectURL(new Blob([response.data])) }) - .catch(e => { - return e - }) } removeBackground(list) { const cancel = this.setLoading() return this.http.delete(`/lists/${list.id}/background`, list) - .then(response => { - return Promise.resolve(response.data) - }) - .catch(error => { - return this.errorHandler(error) - }) + .then(response => response.data) .finally(() => { cancel() }) diff --git a/src/services/passwordReset.js b/src/services/passwordReset.js index 6f972504..95b2c94d 100644 --- a/src/services/passwordReset.js +++ b/src/services/passwordReset.js @@ -18,9 +18,6 @@ export default class PasswordResetService extends AbstractService { resetPassword(model) { const cancel = this.setLoading() return this.http.post(this.paths.reset, model) - .catch(error => { - return this.errorHandler(error) - }) .then(response => { return Promise.resolve(this.modelFactory(response.data)) }) @@ -32,9 +29,6 @@ export default class PasswordResetService extends AbstractService { requestResetPassword(model) { const cancel = this.setLoading() return this.http.post(this.paths.requestReset, model) - .catch(error => { - return this.errorHandler(error) - }) .then(response => { return Promise.resolve(this.modelFactory(response.data)) }) diff --git a/src/store/modules/auth.js b/src/store/modules/auth.js index f9e5b159..12795faf 100644 --- a/src/store/modules/auth.js +++ b/src/store/modules/auth.js @@ -159,9 +159,6 @@ export default { ctx.dispatch('checkAuth') return Promise.resolve() }) - .catch(e => { - return Promise.reject(e) - }) .finally(() => { ctx.commit(LOADING, false, {root: true}) }) @@ -174,9 +171,7 @@ export default { .then(r => { saveToken(r.data.token, false) ctx.dispatch('checkAuth') - return Promise.resolve(r.data) - }).catch(e => { - return Promise.reject(e) + return r.data }) }, // Populates user information from jwt token saved in local storage in store @@ -238,7 +233,7 @@ export default { ctx.commit('lastUserRefresh') }) .catch(e => { - console.error('Error while refreshing user info:', e) + throw new Error('Error while refreshing user info:', { cause: e }) }) }, // Renews the api token and saves it to local storage diff --git a/src/store/modules/config.js b/src/store/modules/config.js index 5019d901..7fe8f57b 100644 --- a/src/store/modules/config.js +++ b/src/store/modules/config.js @@ -68,7 +68,6 @@ export default { ctx.commit(CONFIG, r.data) return Promise.resolve(r) }) - .catch(e => Promise.reject(e)) }, redirectToProviderIfNothingElseIsEnabled(ctx) { if (ctx.state.auth.local.enabled === false && diff --git a/src/store/modules/kanban.js b/src/store/modules/kanban.js index cf7413d3..87349c0c 100644 --- a/src/store/modules/kanban.js +++ b/src/store/modules/kanban.js @@ -222,14 +222,9 @@ export default { .then(r => { ctx.commit('setBuckets', r) ctx.commit('setListId', listId) - return Promise.resolve(r) - }) - .catch(e => { - return Promise.reject(e) - }) - .finally(() => { - cancel() + return r }) + .finally(() => cancel()) }, loadNextTasksForBucket(ctx, {listId, ps = {}, bucketId}) { @@ -282,10 +277,7 @@ export default { if (taskService.totalPages <= page) { ctx.commit('setAllTasksLoadedForBucket', bucketId) } - return Promise.resolve(r) - }) - .catch(e => { - return Promise.reject(e) + return r }) .finally(() => { cancel() @@ -300,14 +292,9 @@ export default { return bucketService.create(bucket) .then(r => { ctx.commit('addBucket', r) - return Promise.resolve(r) - }) - .catch(e => { - return Promise.reject(e) - }) - .finally(() => { - cancel() + return r }) + .finally(() => cancel()) }, deleteBucket(ctx, {bucket, params}) { @@ -319,14 +306,9 @@ export default { ctx.commit('removeBucket', bucket) // We reload all buckets because tasks are being moved from the deleted bucket ctx.dispatch('loadBucketsForList', {listId: bucket.listId, params: params}) - return Promise.resolve(r) - }) - .catch(e => { - return Promise.reject(e) - }) - .finally(() => { - cancel() + return r }) + .finally(() => cancel()) }, updateBucket(ctx, updatedBucketData) { diff --git a/src/store/modules/labels.js b/src/store/modules/labels.js index 948636bc..3d113560 100644 --- a/src/store/modules/labels.js +++ b/src/store/modules/labels.js @@ -91,7 +91,6 @@ export default { ctx.commit('setLoaded', true) return Promise.resolve(r) }) - .catch(e => Promise.reject(e)) .finally(() => cancel()) }, deleteLabel(ctx, label) { @@ -103,7 +102,6 @@ export default { ctx.commit('removeLabelById', label) return Promise.resolve(r) }) - .catch(e => Promise.reject(e)) .finally(() => cancel()) }, updateLabel(ctx, label) { @@ -115,7 +113,6 @@ export default { ctx.commit('setLabel', r) return Promise.resolve(r) }) - .catch(e => Promise.reject(e)) .finally(() => cancel()) }, createLabel(ctx, label) { @@ -127,7 +124,6 @@ export default { ctx.commit('setLabel', r) return Promise.resolve(r) }) - .catch(e => Promise.reject(e)) .finally(() => cancel()) }, }, diff --git a/src/store/modules/lists.js b/src/store/modules/lists.js index d67610de..aae097a6 100644 --- a/src/store/modules/lists.js +++ b/src/store/modules/lists.js @@ -53,7 +53,6 @@ export default { ctx.commit('setList', r) return Promise.resolve(r) }) - .catch(e => Promise.reject(e)) .finally(() => cancel()) }, updateList(ctx, list) { @@ -99,10 +98,7 @@ export default { ctx.commit('removeListById', list) ctx.commit('namespaces/removeListFromNamespaceById', list, {root: true}) removeListFromHistory({id: list.id}) - return Promise.resolve(r) - }) - .catch(e => { - return Promise.reject(e) + return r }) .finally(() => cancel()) }, diff --git a/src/store/modules/namespaces.js b/src/store/modules/namespaces.js index 01e37ed2..2bbe8dcd 100644 --- a/src/store/modules/namespaces.js +++ b/src/store/modules/namespaces.js @@ -115,7 +115,6 @@ export default { return Promise.resolve(r) }) - .catch(e => Promise.reject(e)) .finally(() => { cancel() }) @@ -141,7 +140,6 @@ export default { ctx.commit('removeNamespaceById', namespace.id) return Promise.resolve(r) }) - .catch(e => Promise.reject(e)) .finally(() => cancel()) }, createNamespace(ctx, namespace) { @@ -153,7 +151,6 @@ export default { ctx.commit('addNamespace', r) return Promise.resolve(r) }) - .catch(e => Promise.reject(e)) .finally(() => cancel()) }, }, diff --git a/src/store/modules/tasks.js b/src/store/modules/tasks.js index cb5c6633..ddc628af 100644 --- a/src/store/modules/tasks.js +++ b/src/store/modules/tasks.js @@ -45,7 +45,6 @@ function addLabelToTask(task, label) { task.labels.push(label) return Promise.resolve(result) }) - .catch(e => Promise.reject(e)) } function findAssignees(parsedTaskAssignees) { @@ -77,9 +76,6 @@ export default { ctx.commit(HAS_TASKS, r.length > 0, {root: true}) return r }) - .catch(e => { - return Promise.reject(e) - }) .finally(() => { cancel() }) @@ -92,10 +88,7 @@ export default { return taskService.update(task) .then(t => { ctx.commit('kanban/setTaskInBucket', t, {root: true}) - return Promise.resolve(t) - }) - .catch(e => { - return Promise.reject(e) + return t }) .finally(() => { cancel() @@ -106,10 +99,7 @@ export default { return taskService.delete(task) .then(t => { ctx.commit('kanban/removeTaskInBucket', task, {root: true}) - return Promise.resolve(t) - }) - .catch(e => { - return Promise.reject(e) + return t }) }, // Adds a task attachment in store. @@ -151,10 +141,7 @@ export default { // FIXME: direct store manipulation (task) t.task.assignees.push(user) ctx.commit('kanban/setTaskInBucketByIndex', t, {root: true}) - return Promise.resolve(r) - }) - .catch(e => { - return Promise.reject(e) + return r }) }, removeAssignee(ctx, {user, taskId}) { @@ -182,10 +169,7 @@ export default { } ctx.commit('kanban/setTaskInBucketByIndex', t, {root: true}) - return Promise.resolve(r) - }) - .catch(e => { - return Promise.reject(e) + return r }) }, @@ -208,10 +192,7 @@ export default { t.task.labels.push(label) ctx.commit('kanban/setTaskInBucketByIndex', t, {root: true}) - return Promise.resolve(r) - }) - .catch(e => { - return Promise.reject(e) + return r }) }, @@ -241,10 +222,7 @@ export default { ctx.commit('kanban/setTaskInBucketByIndex', t, {root: true}) - return Promise.resolve(r) - }) - .catch(e => { - return Promise.reject(e) + return r }) }, @@ -296,7 +274,7 @@ export default { // 4. If none of the above worked, reject the promise with an error. if (typeof foundListId === 'undefined' || listId === null) { - return Promise.reject('NO_LIST') + throw new Error('NO_LIST') } return foundListId @@ -336,7 +314,6 @@ export default { task, parsedLabels:parsedTask.labels, })) - .catch(e => Promise.reject(e)) }, }, } \ No newline at end of file diff --git a/src/views/filters/CreateSavedFilter.vue b/src/views/filters/CreateSavedFilter.vue index fe45f1cd..4b7c30d8 100644 --- a/src/views/filters/CreateSavedFilter.vue +++ b/src/views/filters/CreateSavedFilter.vue @@ -100,7 +100,6 @@ export default { this.$store.dispatch('namespaces/loadNamespaces') this.$router.push({name: 'list.index', params: {listId: r.getListId()}}) }) - .catch(e => this.$message.error(e)) }, }, } diff --git a/src/views/filters/settings/delete.vue b/src/views/filters/settings/delete.vue index a95ba565..f581890d 100644 --- a/src/views/filters/settings/delete.vue +++ b/src/views/filters/settings/delete.vue @@ -35,7 +35,6 @@ export default { this.$message.success({message: this.$t('filters.delete.success')}) this.$router.push({name: 'namespaces.index'}) }) - .catch(e => this.$message.error(e)) }, }, } diff --git a/src/views/filters/settings/edit.vue b/src/views/filters/settings/edit.vue index 2834adf9..bb3ef8fb 100644 --- a/src/views/filters/settings/edit.vue +++ b/src/views/filters/settings/edit.vue @@ -105,7 +105,6 @@ export default { this.filter = r this.filters = objectToSnakeCase(this.filter.filters) }) - .catch(e => this.$message.error(e)) }, save() { this.filter.filters = this.filters @@ -117,7 +116,6 @@ export default { this.filters = objectToSnakeCase(this.filter.filters) this.$router.back() }) - .catch(e => this.$message.error(e)) }, }, } diff --git a/src/views/labels/ListLabels.vue b/src/views/labels/ListLabels.vue index a7a2b9d4..f49baafe 100644 --- a/src/views/labels/ListLabels.vue +++ b/src/views/labels/ListLabels.vue @@ -133,27 +133,18 @@ export default { methods: { loadLabels() { this.$store.dispatch('labels/loadAllLabels') - .catch(e => { - this.$message.error(e) - }) }, deleteLabel(label) { this.$store.dispatch('labels/deleteLabel', label) .then(() => { this.$message.success({message: this.$t('label.deleteSuccess')}) }) - .catch(e => { - this.$message.error(e) - }) }, editLabelSubmit() { this.$store.dispatch('labels/updateLabel', this.labelEditLabel) .then(() => { this.$message.success({message: this.$t('label.edit.success')}) }) - .catch(e => { - this.$message.error(e) - }) }, editLabel(label) { if (label.createdBy.id !== this.userInfo.id) { diff --git a/src/views/labels/NewLabel.vue b/src/views/labels/NewLabel.vue index 87506bba..30560cba 100644 --- a/src/views/labels/NewLabel.vue +++ b/src/views/labels/NewLabel.vue @@ -75,9 +75,6 @@ export default { }) this.$message.success({message: this.$t('label.create.success')}) }) - .catch((e) => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/list/NewList.vue b/src/views/list/NewList.vue index 3bb96771..326422f4 100644 --- a/src/views/list/NewList.vue +++ b/src/views/list/NewList.vue @@ -71,9 +71,6 @@ export default { params: { listId: r.id }, }) }) - .catch((e) => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/list/ShowList.vue b/src/views/list/ShowList.vue index 8c41d2dd..9e761345 100644 --- a/src/views/list/ShowList.vue +++ b/src/views/list/ShowList.vue @@ -144,9 +144,6 @@ export default { this.$store.dispatch(CURRENT_LIST, r) this.setTitle(this.getListTitle(r)) }) - .catch(e => { - this.$message.error(e) - }) .finally(() => { this.listLoaded = this.$route.params.listId }) diff --git a/src/views/list/settings/archive.vue b/src/views/list/settings/archive.vue index 86f595bf..c5afb790 100644 --- a/src/views/list/settings/archive.vue +++ b/src/views/list/settings/archive.vue @@ -42,9 +42,6 @@ export default { this.$store.commit('namespaces/setListInNamespaceById', r) this.$message.success({message: this.$t('list.archive.success')}) }) - .catch(e => { - this.$message.error(e) - }) .finally(() => { this.$router.back() }) diff --git a/src/views/list/settings/background.vue b/src/views/list/settings/background.vue index f2c8f913..6ae39094 100644 --- a/src/views/list/settings/background.vue +++ b/src/views/list/settings/background.vue @@ -128,9 +128,6 @@ export default { }) }) }) - .catch(e => { - this.$message.error(e) - }) }, 300) }, setBackground(backgroundId) { @@ -145,9 +142,6 @@ export default { this.$store.commit('namespaces/setListInNamespaceById', l) this.$message.success({message: this.$t('list.background.success')}) }) - .catch(e => { - this.$message.error(e) - }) }, uploadBackground() { if (this.$refs.backgroundUploadInput.files.length === 0) { @@ -160,9 +154,6 @@ export default { this.$store.commit('namespaces/setListInNamespaceById', l) this.$message.success({message: this.$t('list.background.success')}) }) - .catch(e => { - this.$message.error(e) - }) }, removeBackground() { this.listService.removeBackground(this.currentList) @@ -172,9 +163,6 @@ export default { this.$message.success({message: this.$t('list.background.removeSuccess')}) this.$router.back() }) - .catch(e => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/list/settings/delete.vue b/src/views/list/settings/delete.vue index 2f614dba..3e6e30f5 100644 --- a/src/views/list/settings/delete.vue +++ b/src/views/list/settings/delete.vue @@ -30,9 +30,6 @@ export default { this.$message.success({message: this.$t('list.delete.success')}) this.$router.push({name: 'home'}) }) - .catch(e => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/list/settings/duplicate.vue b/src/views/list/settings/duplicate.vue index 184e57a7..7ac07cd5 100644 --- a/src/views/list/settings/duplicate.vue +++ b/src/views/list/settings/duplicate.vue @@ -50,9 +50,6 @@ export default { this.$message.success({message: this.$t('list.duplicate.success')}) this.$router.push({name: 'list.index', params: {listId: r.list.id}}) }) - .catch(e => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/list/settings/edit.vue b/src/views/list/settings/edit.vue index 5d39644a..aafb0503 100644 --- a/src/views/list/settings/edit.vue +++ b/src/views/list/settings/edit.vue @@ -101,9 +101,6 @@ export default { .then(r => { this.list = { ...r } }) - .catch(e => { - this.$message.error(e) - }) }, save() { this.$store.dispatch('lists/updateList', this.list) @@ -113,9 +110,6 @@ export default { this.$message.success({message: this.$t('list.edit.success')}) this.$router.back() }) - .catch(e => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/list/settings/share.vue b/src/views/list/settings/share.vue index e60f3139..257df938 100644 --- a/src/views/list/settings/share.vue +++ b/src/views/list/settings/share.vue @@ -68,9 +68,6 @@ export default { this.manageUsersComponent = 'userTeam' this.setTitle(this.$t('list.share.title', {list: this.list.title})) }) - .catch(e => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/list/views/Kanban.vue b/src/views/list/views/Kanban.vue index e91c1a2d..e918dd96 100644 --- a/src/views/list/views/Kanban.vue +++ b/src/views/list/views/Kanban.vue @@ -565,7 +565,6 @@ export default { } this.$store.dispatch('kanban/updateBucket', newBucket) .then(() => this.$message.success({message: this.$t('list.kanban.doneBucketSavedSuccess')})) - .catch(e => this.$message.error(e)) }, collapseBucket(bucket) { this.collapsedBuckets[bucket.id] = true diff --git a/src/views/list/views/List.vue b/src/views/list/views/List.vue index a41fea56..c853440c 100644 --- a/src/views/list/views/List.vue +++ b/src/views/list/views/List.vue @@ -307,9 +307,6 @@ export default { .then(r => { this.tasks[e.newIndex] = r }) - .catch(e => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/namespaces/NewNamespace.vue b/src/views/namespaces/NewNamespace.vue index e4c55670..e5746859 100644 --- a/src/views/namespaces/NewNamespace.vue +++ b/src/views/namespaces/NewNamespace.vue @@ -77,9 +77,6 @@ export default { this.$message.success({message: this.$t('namespace.create.success') }) this.$router.back() }) - .catch((e) => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/namespaces/settings/archive.vue b/src/views/namespaces/settings/archive.vue index 0a7d4a1e..7d98aabf 100644 --- a/src/views/namespaces/settings/archive.vue +++ b/src/views/namespaces/settings/archive.vue @@ -40,9 +40,6 @@ export default { this.$store.commit('namespaces/setNamespaceById', r) this.$message.success({message: this.$t('namespace.archive.success')}) }) - .catch(e => { - this.$message.error(e) - }) .finally(() => { this.$router.back() }) diff --git a/src/views/namespaces/settings/delete.vue b/src/views/namespaces/settings/delete.vue index 07f026b4..60fe51ff 100644 --- a/src/views/namespaces/settings/delete.vue +++ b/src/views/namespaces/settings/delete.vue @@ -41,9 +41,6 @@ export default { this.$message.success({message: this.$t('namespace.delete.success')}) this.$router.push({name: 'home'}) }) - .catch(e => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/namespaces/settings/edit.vue b/src/views/namespaces/settings/edit.vue index 6e4e01ce..459c8ccf 100644 --- a/src/views/namespaces/settings/edit.vue +++ b/src/views/namespaces/settings/edit.vue @@ -112,9 +112,6 @@ export default { this.title = this.$t('namespace.edit.title', {namespace: r.title}) this.setTitle(this.title) }) - .catch(e => { - this.$message.error(e) - }) }, save() { this.namespaceService.update(this.namespace) @@ -124,9 +121,6 @@ export default { this.$message.success({message: this.$t('namespace.edit.success')}) this.$router.back() }) - .catch(e => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/namespaces/settings/share.vue b/src/views/namespaces/settings/share.vue index 55f89781..e218f52e 100644 --- a/src/views/namespaces/settings/share.vue +++ b/src/views/namespaces/settings/share.vue @@ -68,9 +68,6 @@ export default { this.title = this.$t('namespace.share.title', { namespace: this.namespace.title }) this.setTitle(this.title) }) - .catch(e => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/tasks/ShowTasks.vue b/src/views/tasks/ShowTasks.vue index 0e24b769..8cac15c3 100644 --- a/src/views/tasks/ShowTasks.vue +++ b/src/views/tasks/ShowTasks.vue @@ -211,9 +211,6 @@ export default { this.tasks = tasks }) - .catch(e => { - this.$message.error(e) - }) }, updateTasks(updatedTask) { for (const t in this.tasks) { diff --git a/src/views/tasks/TaskDetailView.vue b/src/views/tasks/TaskDetailView.vue index 4ada14bf..d4f43dde 100644 --- a/src/views/tasks/TaskDetailView.vue +++ b/src/views/tasks/TaskDetailView.vue @@ -574,9 +574,6 @@ export default { this.setActiveFields() this.setTitle(this.task.title) }) - .catch(e => { - this.$message.error(e) - }) .finally(() => { this.$nextTick(() => this.visible = true) this.scrollToHeading() @@ -620,25 +617,21 @@ export default { this.task.endDate = this.task.dueDate } - try { - this.task = await this.$store.dispatch('tasks/update', this.task) - this.setActiveFields() + this.task = await this.$store.dispatch('tasks/update', this.task) + this.setActiveFields() - if (!showNotification) { - return - } - - let actions = [] - if (undoCallback !== null) { - actions = [{ - title: 'Undo', - callback: undoCallback, - }] - } - this.$message.success({message: this.$t('task.detail.updateSuccess')}, actions) - } catch(e) { - this.$message.error(e) + if (!showNotification) { + return } + + let actions = [] + if (undoCallback !== null) { + actions = [{ + title: 'Undo', + callback: undoCallback, + }] + } + this.$message.success({message: this.$t('task.detail.updateSuccess')}, actions) }, setFieldActive(fieldName) { this.activeFields[fieldName] = true @@ -664,9 +657,6 @@ export default { this.$message.success({message: this.$t('task.detail.deleteSuccess')}) this.$router.push({name: 'list.index', params: {listId: this.task.listId}}) }) - .catch(e => { - this.$message.error(e) - }) }, toggleTaskDone() { this.task.done = !this.task.done @@ -705,9 +695,6 @@ export default { this.task = t this.$store.dispatch('namespaces/loadNamespacesIfFavoritesDontExist') }) - .catch(e => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/teams/EditTeam.vue b/src/views/teams/EditTeam.vue index d2e9e272..25c89b94 100644 --- a/src/views/teams/EditTeam.vue +++ b/src/views/teams/EditTeam.vue @@ -229,9 +229,6 @@ export default { this.title = this.$t('team.edit.title', {team: this.team.name}) this.setTitle(this.title) }) - .catch((e) => { - this.$message.error(e) - }) }, save() { if (this.team.name === '') { @@ -246,9 +243,6 @@ export default { this.team = response this.$message.success({message: this.$t('team.edit.success')}) }) - .catch((e) => { - this.$message.error(e) - }) }, deleteTeam() { this.teamService @@ -257,9 +251,6 @@ export default { this.$message.success({message: this.$t('team.edit.delete.success')}) this.$router.push({name: 'teams.index'}) }) - .catch((e) => { - this.$message.error(e) - }) }, deleteUser() { this.teamMemberService @@ -268,9 +259,6 @@ export default { this.$message.success({message: this.$t('team.edit.deleteUser.success')}) this.loadTeam() }) - .catch((e) => { - this.$message.error(e) - }) .finally(() => { this.showUserDeleteModal = false }) @@ -286,9 +274,6 @@ export default { this.loadTeam() this.$message.success({message: this.$t('team.edit.userAddedSuccess')}) }) - .catch((e) => { - this.$message.error(e) - }) }, toggleUserType(member) { member.admin = !member.admin @@ -308,9 +293,6 @@ export default { this.$t('team.edit.madeMember'), }) }) - .catch((e) => { - this.$message.error(e) - }) }, findUser(query) { if (query === '') { @@ -323,9 +305,6 @@ export default { .then((response) => { this.foundUsers = response }) - .catch((e) => { - this.$message.error(e) - }) }, clearAll() { this.foundUsers = [] diff --git a/src/views/teams/ListTeams.vue b/src/views/teams/ListTeams.vue index 66ab034a..8d028449 100644 --- a/src/views/teams/ListTeams.vue +++ b/src/views/teams/ListTeams.vue @@ -48,9 +48,6 @@ export default { .then(response => { this.teams = response }) - .catch(e => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/teams/NewTeam.vue b/src/views/teams/NewTeam.vue index a92f50b3..d13e37c5 100644 --- a/src/views/teams/NewTeam.vue +++ b/src/views/teams/NewTeam.vue @@ -65,9 +65,6 @@ export default { }) this.$message.success({message: this.$t('team.create.success') }) }) - .catch((e) => { - this.$message.error(e) - }) }, }, } diff --git a/src/views/user/DataExportDownload.vue b/src/views/user/DataExportDownload.vue index 71507c52..c8db6541 100644 --- a/src/views/user/DataExportDownload.vue +++ b/src/views/user/DataExportDownload.vue @@ -57,7 +57,6 @@ export default { } this.dataExportService.download(this.password) - .catch(e => this.$message.error(e)) }, }, } diff --git a/src/views/user/Register.vue b/src/views/user/Register.vue index 7d3b24ec..08792d15 100644 --- a/src/views/user/Register.vue +++ b/src/views/user/Register.vue @@ -147,7 +147,6 @@ export default { } this.$store.dispatch('auth/register', credentials) - .catch(() => {}) }, }, } diff --git a/src/views/user/Settings.vue b/src/views/user/Settings.vue index e2f4a4ed..9ede261d 100644 --- a/src/views/user/Settings.vue +++ b/src/views/user/Settings.vue @@ -395,14 +395,12 @@ export default { .then(() => { this.$message.success({message: this.$t('user.settings.passwordUpdateSuccess')}) }) - .catch(e => this.$message.error(e)) }, updateEmail() { this.emailUpdateService.update(this.emailUpdate) .then(() => { this.$message.success({message: this.$t('user.settings.updateEmailSuccess')}) }) - .catch(e => this.$message.error(e)) }, totpStatus() { if (!this.totpEnabled) { @@ -420,7 +418,7 @@ export default { return } - this.$message.error(e) + throw e }) }, totpSetQrCode() { @@ -437,7 +435,6 @@ export default { this.totp = r this.totpSetQrCode() }) - .catch(e => this.$message.error(e)) }, totpConfirm() { this.totpService.enable({passcode: this.totpConfirmPasscode}) @@ -445,7 +442,6 @@ export default { this.totp.enabled = true this.$message.success({message: this.$t('user.settings.totp.confirmSuccess')}) }) - .catch(e => this.$message.error(e)) }, totpDisable() { this.totpService.disable({password: this.totpDisablePassword}) @@ -454,7 +450,6 @@ export default { this.totp = new TotpModel() this.$message.success({message: this.$t('user.settings.totp.disableSuccess')}) }) - .catch(e => this.$message.error(e)) }, updateSettings() { localStorage.setItem(playSoundWhenDoneKey, this.playSoundWhenDone) @@ -467,7 +462,6 @@ export default { this.$store.commit('auth/setUserSettings', this.settings) this.$message.success({message: this.$t('user.settings.general.savedSuccess')}) }) - .catch(e => this.$message.error(e)) }, anchorHashCheck() { if (window.location.hash === this.$route.hash) {