Spaces:
Paused
Paused
Update src/app/engine/render.ts
Browse files- src/app/engine/render.ts +4 -5
src/app/engine/render.ts
CHANGED
@@ -273,14 +273,13 @@ export async function newRender({
|
|
273 |
// next: { revalidate: 1 }
|
274 |
})
|
275 |
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
|
280 |
const response = (await res.json()) as { output: string[], id: string, message: string, status: string}
|
281 |
-
console.log('response1: ', response)
|
282 |
if (response.status === 'error') {
|
283 |
-
throw new Error(
|
284 |
}
|
285 |
// if (!response.output || !response.output[0]) {
|
286 |
// throw new Error(`Failed to fetch data`)
|
|
|
273 |
// next: { revalidate: 1 }
|
274 |
})
|
275 |
|
276 |
+
if (res.status !== 200) {
|
277 |
+
throw new Error('Failed to fetch data')
|
278 |
+
}
|
279 |
|
280 |
const response = (await res.json()) as { output: string[], id: string, message: string, status: string}
|
|
|
281 |
if (response.status === 'error') {
|
282 |
+
throw new Error(response.message)
|
283 |
}
|
284 |
// if (!response.output || !response.output[0]) {
|
285 |
// throw new Error(`Failed to fetch data`)
|