MCPcopy Create free account
hub / github.com/AmazingAng/PolyWorld / apiError

Function apiError

src/lib/apiError.ts:7–14  ·  view source on GitHub ↗
(route: string, message: string, status = 500, err?: unknown)

Source from the content-addressed store, hash-verified

5 * All API routes should use this for consistent error handling.
6 */
7export function apiError(route: string, message: string, status = 500, err?: unknown) {
8 if (err) {
9 console.error(`[api/${route}] ${message}:`, err);
10 } else {
11 console.error(`[api/${route}] ${message}`);
12 }
13 return NextResponse.json({ error: message }, { status });
14}

Callers 10

GETFunction · 0.90
POSTFunction · 0.90
GETFunction · 0.90
GETFunction · 0.90
GETFunction · 0.90
POSTFunction · 0.90
POSTFunction · 0.90
GETFunction · 0.90
GETFunction · 0.90
GETFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected