Home / Function/ getTroubleshootingErrorsByTopic() — supabase Function Reference

getTroubleshootingErrorsByTopic() — supabase Function Reference

Architecture documentation for the getTroubleshootingErrorsByTopic() function in Troubleshooting.utils.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  7aea9dc5_5217_e3f1_4239_79f2598fc256["getTroubleshootingErrorsByTopic()"]
  7788a844_70a7_2b57_5bcb_27bb6e42f5be["SectionTroubleshootingPage()"]
  7788a844_70a7_2b57_5bcb_27bb6e42f5be -->|calls| 7aea9dc5_5217_e3f1_4239_79f2598fc256
  8905791f_ebfd_ddd9_ad47_1c7f6198a3e9["getTroubleshootingEntriesByTopic()"]
  7aea9dc5_5217_e3f1_4239_79f2598fc256 -->|calls| 8905791f_ebfd_ddd9_ad47_1c7f6198a3e9
  b6e53903_33ec_9995_3031_d400948426c7["formatError()"]
  7aea9dc5_5217_e3f1_4239_79f2598fc256 -->|calls| b6e53903_33ec_9995_3031_d400948426c7
  style 7aea9dc5_5217_e3f1_4239_79f2598fc256 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/features/docs/Troubleshooting.utils.ts lines 139–166

export async function getTroubleshootingErrorsByTopic(
  topic: ITroubleshootingMetadata['topics'][number]
) {
  const entries = await getTroubleshootingEntriesByTopic(topic)
  const allErrors = new Set(
    entries
      .flatMap((entry) => entry.data.errors ?? [])
      .filter((error) => error?.http_status_code || error?.code)
  )

  const seen = new Set<string>()
  for (const error of allErrors) {
    const key = formatError(error)
    if (seen.has(key)) {
      allErrors.delete(error)
    }
    seen.add(key)
  }

  function sortErrors(
    a: NonNullable<ITroubleshootingMetadata['errors']>[number],
    b: NonNullable<ITroubleshootingMetadata['errors']>[number]
  ) {
    return formatError(a).localeCompare(formatError(b))
  }

  return Array.from(allErrors).sort(sortErrors)
}

Subdomains

Frequently Asked Questions

What does getTroubleshootingErrorsByTopic() do?
getTroubleshootingErrorsByTopic() is a function in the supabase codebase.
What does getTroubleshootingErrorsByTopic() call?
getTroubleshootingErrorsByTopic() calls 2 function(s): formatError, getTroubleshootingEntriesByTopic.
What calls getTroubleshootingErrorsByTopic()?
getTroubleshootingErrorsByTopic() is called by 1 function(s): SectionTroubleshootingPage.

Analyze Your Own Codebase

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

Try Supermodel Free