Skip to main content
Consistent error handling makes your API predictable for clients and easier to debug. This guide shows patterns that fit the current EdgeSpark scaffold and runtime SDK.

Return a standard error shape

server/src/index.ts

Handle not found

server/src/index.ts

Catch unexpected errors

server/src/index.ts

Register global handlers

server/src/index.ts

Standard status codes

The platform automatically returns 401 for unauthenticated requests to /api/* routes before your handler runs. You usually only need to handle 403 Forbidden yourself.

See also

Build a REST API

A complete example with validation, auth, uploads, and error handling.

View logs

Read runtime logs and exceptions from your deployed project.
Last modified on April 7, 2026