Home / Class/ CollectionQueryError Class — supabase Architecture

CollectionQueryError Class — supabase Architecture

Architecture documentation for the CollectionQueryError class in utils.ts from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/docs/app/api/utils.ts lines 97–122

export class CollectionQueryError extends Error {
  constructor(
    message: string,
    public readonly queryErrors: {
      count?: PostgrestError
      data?: PostgrestError
    }
  ) {
    super(message)
  }

  public static fromErrors(
    countError: PostgrestError | undefined,
    dataError: PostgrestError | undefined
  ): CollectionQueryError {
    const fetchFailedFor =
      countError && dataError ? 'count and collection' : countError ? 'count' : 'collection'
    let message = `Failed to fetch ${fetchFailedFor}`
    if (countError) message += `: CountError: ${countError.message}`
    if (dataError) message += `: CollectionError: ${dataError.message}`
    return new CollectionQueryError(message, {
      count: countError,
      data: dataError,
    })
  }
}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free