testing global error handling

This commit is contained in:
Henry Jameson 2026-06-26 16:01:30 +03:00
commit ac538da1d8
2 changed files with 9 additions and 0 deletions

View file

@ -467,6 +467,11 @@ const afterStoreSetup = async ({ pinia, store, storageError, i18n }) => {
// "Plugins are only applied to stores created after the plugins themselves, and after pinia is passed to the app, otherwise they won't be applied." // "Plugins are only applied to stores created after the plugins themselves, and after pinia is passed to the app, otherwise they won't be applied."
app.use(pinia) app.use(pinia)
app.config.errorHandler = (error, instance, info) => {
console.error('GLOBAL ERROR HANDLER', error, instance, info)
useInterfaceStore().setGlobalError({ error, instance, info })
}
const waitForAllStoresToLoad = async () => { const waitForAllStoresToLoad = async () => {
// the stores that do not persist technically do not need to be awaited here, // the stores that do not persist technically do not need to be awaited here,
// but that involves either hard-coding the stores in some place (prone to errors) // but that involves either hard-coding the stores in some place (prone to errors)

View file

@ -58,6 +58,7 @@ export const useInterfaceStore = defineStore('interface', {
}, },
layoutType: 'normal', layoutType: 'normal',
globalNotices: [], globalNotices: [],
globalError: null,
layoutHeight: 0, layoutHeight: 0,
lastTimeline: null, lastTimeline: null,
foreignProfileBackground: null, foreignProfileBackground: null,
@ -176,6 +177,9 @@ export const useInterfaceStore = defineStore('interface', {
removeGlobalNotice(notice) { removeGlobalNotice(notice) {
this.globalNotices = this.globalNotices.filter((n) => n !== notice) this.globalNotices = this.globalNotices.filter((n) => n !== notice)
}, },
setGlobalError(data) {
this.globalError = data
},
pushGlobalNotice({ pushGlobalNotice({
messageKey, messageKey,
messageArgs = {}, messageArgs = {},