diff --git a/src/lib/app/error.ts b/src/lib/app/error.ts index 8a682e8c..9249379f 100644 --- a/src/lib/app/error.ts +++ b/src/lib/app/error.ts @@ -1,6 +1,16 @@ +import { t } from "./i18n" + // eslint-disable-next-line export function errorMessage(error: any, instance?: string): string { try { + if (typeof error == 'string') { + try { + error = JSON.parse(error) + } catch { + /* try without catch would be cool imo */ + } + } + if (error?.body?.message) { error = JSON.parse(error?.body?.message).error } else if (error?.message) {