Compare commits
1 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
3a02c84b94 |
|
|
@ -126,6 +126,8 @@ Square format, clean edges for die-cut sticker."""
|
||||||
status_code=504,
|
status_code=504,
|
||||||
detail="AI generation timed out"
|
detail="AI generation timed out"
|
||||||
)
|
)
|
||||||
|
except HTTPException:
|
||||||
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=502,
|
status_code=502,
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,15 @@ export default function DesignPage() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const data = await response.json();
|
let message = "Failed to generate design";
|
||||||
throw new Error(data.detail || "Failed to generate design");
|
try {
|
||||||
|
const data = await response.json();
|
||||||
|
message = data.detail || message;
|
||||||
|
} catch {
|
||||||
|
const text = await response.text();
|
||||||
|
message = text || `Server error (${response.status})`;
|
||||||
|
}
|
||||||
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
const design = await response.json();
|
const design = await response.json();
|
||||||
|
|
@ -82,8 +89,15 @@ export default function DesignPage() {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const data = await response.json();
|
let message = "Failed to activate design";
|
||||||
throw new Error(data.detail || "Failed to activate design");
|
try {
|
||||||
|
const data = await response.json();
|
||||||
|
message = data.detail || message;
|
||||||
|
} catch {
|
||||||
|
const text = await response.text();
|
||||||
|
message = text || `Server error (${response.status})`;
|
||||||
|
}
|
||||||
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
setGeneratedDesign({ ...generatedDesign, status: "active" });
|
setGeneratedDesign({ ...generatedDesign, status: "active" });
|
||||||
|
|
@ -106,8 +120,15 @@ export default function DesignPage() {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const data = await response.json();
|
let message = "Failed to delete design";
|
||||||
throw new Error(data.detail || "Failed to delete design");
|
try {
|
||||||
|
const data = await response.json();
|
||||||
|
message = data.detail || message;
|
||||||
|
} catch {
|
||||||
|
const text = await response.text();
|
||||||
|
message = text || `Server error (${response.status})`;
|
||||||
|
}
|
||||||
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
setGeneratedDesign(null);
|
setGeneratedDesign(null);
|
||||||
|
|
|
||||||
|
|
@ -103,8 +103,15 @@ export default function UploadPage() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const data = await response.json();
|
let message = "Upload failed";
|
||||||
throw new Error(data.detail || "Upload failed");
|
try {
|
||||||
|
const data = await response.json();
|
||||||
|
message = data.detail || message;
|
||||||
|
} catch {
|
||||||
|
const text = await response.text();
|
||||||
|
message = text || `Server error (${response.status})`;
|
||||||
|
}
|
||||||
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
const design = await response.json();
|
const design = await response.json();
|
||||||
|
|
@ -127,8 +134,15 @@ export default function UploadPage() {
|
||||||
{ method: "POST" }
|
{ method: "POST" }
|
||||||
);
|
);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const data = await response.json();
|
let message = "Failed to activate design";
|
||||||
throw new Error(data.detail || "Failed to activate design");
|
try {
|
||||||
|
const data = await response.json();
|
||||||
|
message = data.detail || message;
|
||||||
|
} catch {
|
||||||
|
const text = await response.text();
|
||||||
|
message = text || `Server error (${response.status})`;
|
||||||
|
}
|
||||||
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
setUploadedDesign({ ...uploadedDesign, status: "active" });
|
setUploadedDesign({ ...uploadedDesign, status: "active" });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
@ -146,8 +160,15 @@ export default function UploadPage() {
|
||||||
{ method: "DELETE" }
|
{ method: "DELETE" }
|
||||||
);
|
);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const data = await response.json();
|
let message = "Failed to delete design";
|
||||||
throw new Error(data.detail || "Failed to delete design");
|
try {
|
||||||
|
const data = await response.json();
|
||||||
|
message = data.detail || message;
|
||||||
|
} catch {
|
||||||
|
const text = await response.text();
|
||||||
|
message = text || `Server error (${response.status})`;
|
||||||
|
}
|
||||||
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
resetForm();
|
resetForm();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue