Spaces:
Runtime error
Runtime error
Antigravity AI commited on
Commit ·
c3ff878
1
Parent(s): d6937b8
Add global JSON error handler
Browse files
server.js
CHANGED
|
@@ -466,6 +466,15 @@ app.get("/api/status", (req, res) => {
|
|
| 466 |
});
|
| 467 |
});
|
| 468 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 469 |
const PORT = process.env.PORT || 3000;
|
| 470 |
app.listen(PORT, () => {
|
| 471 |
console.log(`GLB Generation Engine running on http://localhost:${PORT}`);
|
|
|
|
| 466 |
});
|
| 467 |
});
|
| 468 |
|
| 469 |
+
// Global error handler
|
| 470 |
+
app.use((err, req, res, next) => {
|
| 471 |
+
console.error("Unhandled error:", err);
|
| 472 |
+
res.status(500).json({
|
| 473 |
+
error: "Internal Server Error",
|
| 474 |
+
message: err.message
|
| 475 |
+
});
|
| 476 |
+
});
|
| 477 |
+
|
| 478 |
const PORT = process.env.PORT || 3000;
|
| 479 |
app.listen(PORT, () => {
|
| 480 |
console.log(`GLB Generation Engine running on http://localhost:${PORT}`);
|