Fix error handling in fetchNative function

This commit is contained in:
kwaroran
2024-03-16 14:58:27 +09:00
parent 18f342437e
commit 665d573610

View File

@@ -1370,9 +1370,14 @@ export async function fetchNative(url:string, arg:{
headers: JSON.stringify(headers),
body: arg.body,
}).then((res) => {
const parsedRes = JSON.parse(res as string)
if(!parsedRes.success){
error = parsedRes.body
try {
const parsedRes = JSON.parse(res as string)
if(!parsedRes.success){
error = parsedRes.body
resolved = true
}
} catch (error) {
error = JSON.stringify(error)
resolved = true
}
})