refactor: output errors on devtools (#928)

This commit is contained in:
三咲智子 Kevin Deng 2023-01-12 13:39:22 +08:00 committed by GitHub
parent 50c54144e6
commit 4e0777d723
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 34 additions and 16 deletions

View file

@ -57,6 +57,9 @@ export const usePublish = (options: {
return status
}
catch (err) {
console.error(err)
}
finally {
isSending = false
}

View file

@ -86,6 +86,8 @@ export function usePaginator<T, P, U = T>(
}
}
catch (e) {
console.error(e)
error.value = e
state.value = 'error'
}

View file

@ -140,7 +140,8 @@ async function loginTo(user?: Omit<UserLogin, 'account'> & { account?: mastodon.
if (!users.value.some(u => u.server === user.server && u.token === user.token))
users.value.push(user as UserLogin)
}
catch {
catch (err) {
console.error(err)
await signout()
}
}
@ -206,7 +207,7 @@ export async function removePushNotificationData(user: UserLogin, fromSWPushMana
await subscription.unsubscribe()
}
catch {
// juts ignore
// just ignore
}
}
}
@ -216,12 +217,7 @@ export async function removePushNotifications(user: UserLogin) {
return
// unsubscribe push notifications
try {
await useMasto().v1.webPushSubscriptions.remove()
}
catch {
// ignore
}
await useMasto().v1.webPushSubscriptions.remove().catch(() => Promise.resolve())
}
export async function signout() {