Add descriptive error messages across all API routes and toast notifications on client pages
Build & Auto-Repair / build (push) Has been cancelled

- 86 catch blocks in 49 API route files now return the actual error message via error.message
- 14 campaign/lead/config catch blocks that lacked console.error now log errors
- 17 client pages/components now show toast.error notifications on API failures
- Silent .catch(() => {}) and finally-only try blocks now surface errors to users
This commit is contained in:
2026-07-01 15:20:30 +02:00
parent 727dcddf37
commit 3fe32d923e
76 changed files with 344 additions and 155 deletions
+6 -3
View File
@@ -39,7 +39,8 @@ export async function GET() {
})
} catch (error) {
console.error("Notifications GET error:", error)
return NextResponse.json({ error: "Failed to load notifications" }, { status: 500 })
const message = error instanceof Error ? error.message : "Failed to load notifications"
return NextResponse.json({ error: message }, { status: 500 })
}
}
@@ -71,7 +72,8 @@ export async function POST(request: NextRequest) {
}, { status: 201 })
} catch (error) {
console.error("Notifications POST error:", error)
return NextResponse.json({ error: "Failed to create notification" }, { status: 500 })
const message = error instanceof Error ? error.message : "Failed to create notification"
return NextResponse.json({ error: message }, { status: 500 })
}
}
@@ -88,6 +90,7 @@ export async function PATCH() {
return NextResponse.json({ success: true })
} catch (error) {
console.error("Notifications PATCH error:", error)
return NextResponse.json({ error: "Failed to mark all as read" }, { status: 500 })
const message = error instanceof Error ? error.message : "Failed to mark all as read"
return NextResponse.json({ error: message }, { status: 500 })
}
}