frontend: better error handling

This commit is contained in:
Qing
2022-06-12 13:01:45 +08:00
parent fd1c1d29a7
commit 55197f2209
2 changed files with 18 additions and 7 deletions

View File

@@ -34,7 +34,11 @@ export default async function inpaint(
method: 'POST',
body: fd,
}).then(async r => {
return r.blob()
console.log(r)
if (r.ok) {
return r.blob()
}
throw new Error('Something went wrong on server side.')
})
return URL.createObjectURL(res)