Server: SupabaseServerError

Base class for every error @supabase/server produces.

Catch this to handle anything originating from this library, regardless of whether it's an EnvError or an AuthError:

Parameters

Examples

Catching any library error

import { SupabaseServerError } from '@supabase/server'

try {
  const supabase = createAdminClient()
} catch (e) {
  if (e instanceof SupabaseServerError) {
    console.error(e.code, e.message, e.hint, e.docs)
    return Response.json(e.toJSON(), { status: e.status })
  }
  throw e
}