Home / Function/ loadErrors() — supabase Function Reference

loadErrors() — supabase Function Reference

Architecture documentation for the loadErrors() function in errorModel.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  50f617d6_81f5_4c21_6f5a_c2f5e6cbefd2["loadErrors()"]
  755e8915_9c62_434e_3517_2349a2c7b217["resolveErrors()"]
  755e8915_9c62_434e_3517_2349a2c7b217 -->|calls| 50f617d6_81f5_4c21_6f5a_c2f5e6cbefd2
  4ee0e422_ccba_fcca_f32d_ae215bba546a["fetchTotalErrorCount()"]
  50f617d6_81f5_4c21_6f5a_c2f5e6cbefd2 -->|calls| 4ee0e422_ccba_fcca_f32d_ae215bba546a
  6e843528_2b0b_a3ef_28c1_d45bcb2743ae["fetchErrorDescriptions()"]
  50f617d6_81f5_4c21_6f5a_c2f5e6cbefd2 -->|calls| 6e843528_2b0b_a3ef_28c1_d45bcb2743ae
  2ba77918_c71f_00b4_2b40_c0b152543573["join()"]
  50f617d6_81f5_4c21_6f5a_c2f5e6cbefd2 -->|calls| 2ba77918_c71f_00b4_2b40_c0b152543573
  040a5796_eb59_9ff7_60d0_b127fcaa25c2["map()"]
  50f617d6_81f5_4c21_6f5a_c2f5e6cbefd2 -->|calls| 040a5796_eb59_9ff7_60d0_b127fcaa25c2
  633da633_56bc_96a8_6477_207ace68b6c7["mapError()"]
  50f617d6_81f5_4c21_6f5a_c2f5e6cbefd2 -->|calls| 633da633_56bc_96a8_6477_207ace68b6c7
  a2b11de1_3d7b_be72_32dc_7d4ef0495eb0["fromErrors()"]
  50f617d6_81f5_4c21_6f5a_c2f5e6cbefd2 -->|calls| a2b11de1_3d7b_be72_32dc_7d4ef0495eb0
  style 50f617d6_81f5_4c21_6f5a_c2f5e6cbefd2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/resources/error/errorModel.ts lines 96–132

  static async loadErrors(
    args: Parameters<ErrorCollectionFetch>[0]
  ): ReturnType<ErrorCollectionFetch> {
    const PAGE_SIZE = 20
    const limit = args?.first ?? args?.last ?? PAGE_SIZE
    const service = args?.additionalArgs?.service as Service | undefined
    const code = args?.additionalArgs?.code as string | undefined

    const [countResult, errorCodesResult] = await Promise.all([
      fetchTotalErrorCount(service, code),
      fetchErrorDescriptions({
        after: args?.after ?? undefined,
        before: args?.before ?? undefined,
        reverse: !!args?.last,
        limit: limit + 1,
        service,
        code,
      }),
    ])

    return countResult
      .join(errorCodesResult)
      .map(([count, errorCodes]) => {
        const hasMoreItems = errorCodes.length > limit
        const items = args?.last ? errorCodes.slice(1) : errorCodes.slice(0, limit)

        return {
          items: items.map((errorCode) => new ErrorModel(errorCode)),
          totalCount: count,
          hasNextPage: args?.last ? !!args?.before : hasMoreItems,
          hasPreviousPage: args?.last ? hasMoreItems : !!args?.after,
        }
      })
      .mapError(([countError, errorCodeError]) => {
        return CollectionQueryError.fromErrors(countError, errorCodeError)
      })
  }

Subdomains

Called By

Frequently Asked Questions

What does loadErrors() do?
loadErrors() is a function in the supabase codebase.
What does loadErrors() call?
loadErrors() calls 6 function(s): fetchErrorDescriptions, fetchTotalErrorCount, fromErrors, join, map, mapError.
What calls loadErrors()?
loadErrors() is called by 1 function(s): resolveErrors.

Analyze Your Own Codebase

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

Try Supermodel Free