fix: handle validation errors when the response is binary (#3765)

This commit is contained in:
Vlad Stan
2026-02-05 11:55:40 +02:00
committed by GitHub
parent 2e042d2597
commit f079762b71
2 changed files with 6 additions and 2 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+5 -1
View File
@@ -144,7 +144,7 @@ window._lnbitsUtils = {
return null
}
},
notifyApiError(error) {
async notifyApiError(error) {
if (!error.response) {
return console.error(error)
}
@@ -154,6 +154,10 @@ window._lnbitsUtils = {
500: 'negative'
}
let messages = error.response.data.detail
if (!messages) {
const text = await error.response.data?.text()
messages = this.parseJSONSafe(text)?.detail
}
if (messages) {
messages = Array.isArray(messages)
? messages.map(e => e.msg + ` (${e.loc?.join('/')})`)