feat: don't rethrow same error and handle errors globally
This commit is contained in:
@ -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) {
|
||||
|
@ -142,9 +142,6 @@ export default {
|
||||
this.initTaskFields()
|
||||
this.$message.success({message: this.$t('task.detail.updateSuccess')})
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e)
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -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')
|
||||
|
@ -84,9 +84,6 @@ export default {
|
||||
|
||||
this.loadedList = JSON.parse(JSON.stringify(currentList))
|
||||
})
|
||||
.catch(e => {
|
||||
this.$message.error(e)
|
||||
})
|
||||
},
|
||||
|
||||
loadTasksForPage(e) {
|
||||
|
@ -228,9 +228,6 @@ export default {
|
||||
)
|
||||
this.$message.success(r)
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e)
|
||||
})
|
||||
.finally(() => {
|
||||
this.showDeleteModal = false
|
||||
})
|
||||
|
@ -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
|
||||
})
|
||||
|
@ -129,9 +129,6 @@ export default {
|
||||
this.task = r
|
||||
this.$emit('update:modelValue', r)
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e)
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -83,9 +83,6 @@ export default {
|
||||
this.saved = false
|
||||
}, 2000)
|
||||
})
|
||||
.catch(e => {
|
||||
this.$message.error(e)
|
||||
})
|
||||
.finally(() => {
|
||||
this.saving = false
|
||||
})
|
||||
|
@ -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 = []
|
||||
|
@ -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)
|
||||
})
|
||||
},
|
||||
|
||||
},
|
||||
|
@ -82,9 +82,6 @@ export default {
|
||||
this.showSavedMessage = false
|
||||
}, 2000)
|
||||
})
|
||||
.catch(e => {
|
||||
this.$message.error(e)
|
||||
})
|
||||
.finally(() => {
|
||||
this.saving = false
|
||||
})
|
||||
|
@ -104,9 +104,6 @@ export default {
|
||||
playPop()
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
this.$message.error(e)
|
||||
})
|
||||
.finally(() => {
|
||||
this.loadingInternal = false
|
||||
})
|
||||
|
@ -60,9 +60,6 @@ export default {
|
||||
.then(response => {
|
||||
this.foundLists = response
|
||||
})
|
||||
.catch(e => {
|
||||
this.$message.error(e)
|
||||
})
|
||||
},
|
||||
clearAll() {
|
||||
this.foundLists = []
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user