You've already forked AstralRinth
forked from didirus/AstralRinth
fix: DI nonsense (#4174)
* fix: DI nonsense * fix: lint * fix: client try di issue * fix: injects outside of context * fix: use .catch * refactor: convert projects.vue to composition API. * fix: moderation checklist notif pos change watcher * fix: lint issues
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { injectNotificationManager } from '@modrinth/ui'
|
||||
import type { AbstractWebNotificationManager } from '@modrinth/ui'
|
||||
import type { JWTAuth, ModuleError, ModuleName } from '@modrinth/utils'
|
||||
import { ModrinthServerError } from '@modrinth/utils'
|
||||
|
||||
@@ -13,17 +13,16 @@ import {
|
||||
} from './modules/index.ts'
|
||||
import { useServersFetch } from './servers-fetch.ts'
|
||||
|
||||
export function handleError(err: any) {
|
||||
const { addNotification } = injectNotificationManager()
|
||||
export function handleServersError(err: any, notifications: AbstractWebNotificationManager) {
|
||||
if (err instanceof ModrinthServerError && err.v1Error) {
|
||||
addNotification({
|
||||
notifications.addNotification({
|
||||
title: err.v1Error?.context ?? `An error occurred`,
|
||||
type: 'error',
|
||||
text: err.v1Error.description,
|
||||
errorCode: err.v1Error.error,
|
||||
})
|
||||
} else {
|
||||
addNotification({
|
||||
notifications.addNotification({
|
||||
title: 'An error occurred',
|
||||
type: 'error',
|
||||
text: err.message ?? (err.data ? err.data.description : err),
|
||||
|
||||
Reference in New Issue
Block a user