fix: update errorMessage to support lemmy errors again
This commit is contained in:
1 file changed
+10
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user