Plasma
Core concepts

Error Handling

How errors are handled in Plasma

Every method returns a readonly [Error, null] | readonly [null, T] tuple.

const [, ] = await .('get-users')

if () return ()
// data is fully typed and non-null here
.()

Errors are returned (not thrown) for:

  • Network failures
  • Non-2xx HTTP responses
  • JSON parse failures
  • apiPayload Zod validation failures

Errors are thrown for:

  • Missing serverUrl
  • Missing Authorization header on a protected route