Fix error handling in fetchNative function
This commit is contained in:
@@ -1370,9 +1370,14 @@ export async function fetchNative(url:string, arg:{
|
|||||||
headers: JSON.stringify(headers),
|
headers: JSON.stringify(headers),
|
||||||
body: arg.body,
|
body: arg.body,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
const parsedRes = JSON.parse(res as string)
|
try {
|
||||||
if(!parsedRes.success){
|
const parsedRes = JSON.parse(res as string)
|
||||||
error = parsedRes.body
|
if(!parsedRes.success){
|
||||||
|
error = parsedRes.body
|
||||||
|
resolved = true
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
error = JSON.stringify(error)
|
||||||
resolved = true
|
resolved = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user