feat: don't rethrow same error and handle errors globally

This commit is contained in:
Dominik Pschenitschni 2021-10-09 16:04:19 +02:00
parent 6f51921588
commit 3b940cb56c
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
71 changed files with 69 additions and 451 deletions

View file

@ -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))
}
},
},

View file

@ -128,9 +128,6 @@ export default {
},
loadLabels() {
this.$store.dispatch('labels/loadAllLabels')
.catch(e => {
this.$message.error(e)
})
},
},
}

View file

@ -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
@ -262,9 +261,6 @@ export default {
this.$store.dispatch('lists/updateList', {
...list,
position,
})
.catch(e => {
this.$message.error(e)
})
.finally(() => {
this.listUpdating[list.id] = false

View file

@ -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(() => {

View file

@ -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))
},
},
}

View file

@ -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
})

View file

@ -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)
})
},
},
}

View file

@ -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))
}
},
},

View file

@ -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) {

View file

@ -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
})

View file

@ -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 = []

View file

@ -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) {

View file

@ -142,9 +142,6 @@ export default {
this.initTaskFields()
this.$message.success({message: this.$t('task.detail.updateSuccess')})
})
.catch((e) => {
this.$message.error(e)
})
},
},
}

View file

@ -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')

View file

@ -84,9 +84,6 @@ export default {
this.loadedList = JSON.parse(JSON.stringify(currentList))
})
.catch(e => {
this.$message.error(e)
})
},
loadTasksForPage(e) {

View file

@ -228,9 +228,6 @@ export default {
)
this.$message.success(r)
})
.catch((e) => {
this.$message.error(e)
})
.finally(() => {
this.showDeleteModal = false
})

View file

@ -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
})

View file

@ -129,9 +129,6 @@ export default {
this.task = r
this.$emit('update:modelValue', r)
})
.catch((e) => {
this.$message.error(e)
})
},
},
}

View file

@ -83,9 +83,6 @@ export default {
this.saved = false
}, 2000)
})
.catch(e => {
this.$message.error(e)
})
.finally(() => {
this.saving = false
})

View file

@ -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 = []

View file

@ -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)
})
},
},

View file

@ -82,9 +82,6 @@ export default {
this.showSavedMessage = false
}, 2000)
})
.catch(e => {
this.$message.error(e)
})
.finally(() => {
this.saving = false
})

View file

@ -104,9 +104,6 @@ export default {
playPop()
}
})
.catch(e => {
this.$message.error(e)
})
.finally(() => {
this.loadingInternal = false
})

View file

@ -60,9 +60,6 @@ export default {
.then(response => {
this.foundLists = response
})
.catch(e => {
this.$message.error(e)
})
},
clearAll() {
this.foundLists = []

View file

@ -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)

View file

@ -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) {

View file

@ -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

View file

@ -64,7 +64,6 @@ export default {
this.$message.success({message: this.$t('user.export.success')})
this.password = ''
})
.catch(e => this.$message.error(e))
},
},
}

View file

@ -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))
},
},
}

View file

@ -53,9 +53,7 @@ export const refreshToken = (persist: boolean): Promise<AxiosResponse> => {
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 })
})
}

View file

@ -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)
}
}

View file

@ -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,

View file

@ -105,19 +105,6 @@ export default class AbstractService {
return true
}
/////////////////////
// Global error handler
///////////////////
/**
* Handles the error and rejects the promise.
* @param error
* @returns {Promise<never>}
*/
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))
})

View file

@ -27,8 +27,5 @@ export default class BackgroundUnsplashService extends AbstractService {
.then(response => {
return window.URL.createObjectURL(new Blob([response.data]))
})
.catch(e => {
return e
})
}
}

View file

@ -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()
})

View file

@ -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))
})

View file

@ -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

View file

@ -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 &&

View file

@ -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) {

View file

@ -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())
},
},

View file

@ -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())
},

View file

@ -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())
},
},

View file

@ -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))
},
},
}

View file

@ -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))
},
},
}

View file

@ -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))
},
},
}

View file

@ -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))
},
},
}

View file

@ -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) {

View file

@ -75,9 +75,6 @@ export default {
})
this.$message.success({message: this.$t('label.create.success')})
})
.catch((e) => {
this.$message.error(e)
})
},
},
}

View file

@ -71,9 +71,6 @@ export default {
params: { listId: r.id },
})
})
.catch((e) => {
this.$message.error(e)
})
},
},
}

View file

@ -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
})

View file

@ -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()
})

View file

@ -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)
})
},
},
}

View file

@ -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)
})
},
},
}

View file

@ -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)
})
},
},
}

View file

@ -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)
})
},
},
}

View file

@ -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)
})
},
},
}

View file

@ -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

View file

@ -307,9 +307,6 @@ export default {
.then(r => {
this.tasks[e.newIndex] = r
})
.catch(e => {
this.$message.error(e)
})
},
},
}

View file

@ -77,9 +77,6 @@ export default {
this.$message.success({message: this.$t('namespace.create.success') })
this.$router.back()
})
.catch((e) => {
this.$message.error(e)
})
},
},
}

View file

@ -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()
})

View file

@ -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)
})
},
},
}

View file

@ -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)
})
},
},
}

View file

@ -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)
})
},
},
}

View file

@ -211,9 +211,6 @@ export default {
this.tasks = tasks
})
.catch(e => {
this.$message.error(e)
})
},
updateTasks(updatedTask) {
for (const t in this.tasks) {

View file

@ -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,7 +617,6 @@ export default {
this.task.endDate = this.task.dueDate
}
try {
this.task = await this.$store.dispatch('tasks/update', this.task)
this.setActiveFields()
@ -636,9 +632,6 @@ export default {
}]
}
this.$message.success({message: this.$t('task.detail.updateSuccess')}, actions)
} catch(e) {
this.$message.error(e)
}
},
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)
})
},
},
}

View file

@ -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 = []

View file

@ -48,9 +48,6 @@ export default {
.then(response => {
this.teams = response
})
.catch(e => {
this.$message.error(e)
})
},
},
}

View file

@ -65,9 +65,6 @@ export default {
})
this.$message.success({message: this.$t('team.create.success') })
})
.catch((e) => {
this.$message.error(e)
})
},
},
}

View file

@ -57,7 +57,6 @@ export default {
}
this.dataExportService.download(this.password)
.catch(e => this.$message.error(e))
},
},
}

View file

@ -147,7 +147,6 @@ export default {
}
this.$store.dispatch('auth/register', credentials)
.catch(() => {})
},
},
}

View file

@ -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) {