Home / Function/ doFetchErrorCodes() — supabase Function Reference

doFetchErrorCodes() — supabase Function Reference

Architecture documentation for the doFetchErrorCodes() function in errorSync.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  dc251b6d_906f_6c94_fad9_efde7dffb5a6["doFetchErrorCodes()"]
  0dc710ee_65c7_af26_8980_5cb243840ef7["fetchErrorCodes()"]
  0dc710ee_65c7_af26_8980_5cb243840ef7 -->|calls| dc251b6d_906f_6c94_fad9_efde7dffb5a6
  a7b13147_1b94_5dbe_3036_8c86489e129c["tryCatch()"]
  dc251b6d_906f_6c94_fad9_efde7dffb5a6 -->|calls| a7b13147_1b94_5dbe_3036_8c86489e129c
  2ba77918_c71f_00b4_2b40_c0b152543573["join()"]
  dc251b6d_906f_6c94_fad9_efde7dffb5a6 -->|calls| 2ba77918_c71f_00b4_2b40_c0b152543573
  f0cb3c6d_e823_6f6f_b9a4_ab144fc70aa5["extractMessageFromAnyError()"]
  dc251b6d_906f_6c94_fad9_efde7dffb5a6 -->|calls| f0cb3c6d_e823_6f6f_b9a4_ab144fc70aa5
  45f56962_4cb7_83a3_8932_0438eedf9eb9["flatMap()"]
  dc251b6d_906f_6c94_fad9_efde7dffb5a6 -->|calls| 45f56962_4cb7_83a3_8932_0438eedf9eb9
  620eb5e5_42b1_d747_7a19_0bcd646c2b0b["tryCatchSync()"]
  dc251b6d_906f_6c94_fad9_efde7dffb5a6 -->|calls| 620eb5e5_42b1_d747_7a19_0bcd646c2b0b
  040a5796_eb59_9ff7_60d0_b127fcaa25c2["map()"]
  dc251b6d_906f_6c94_fad9_efde7dffb5a6 -->|calls| 040a5796_eb59_9ff7_60d0_b127fcaa25c2
  style dc251b6d_906f_6c94_fad9_efde7dffb5a6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/resources/error/errorSync.ts lines 19–52

async function doFetchErrorCodes(
  file: string,
  service: Service
): Promise<Result<Array<ErrorCodeUploadParameters>, Error>> {
  return (
    await Result.tryCatch(
      () => readFile(path.join(ERROR_CODES_DIRECTORY, file), 'utf8'),
      (error) =>
        new Error(`Failed to read error code file ${file}: ${extractMessageFromAnyError(error)}`, {
          cause: error,
        })
    )
  )
    .flatMap((toml) =>
      Result.tryCatchSync(
        () => parse(toml) as unknown as Record<string, ErrorCodeDefinition>,
        (error) =>
          new Error(
            `Failed to parse error code file ${file}: ${extractMessageFromAnyError(error)}`,
            { cause: error }
          )
      )
    )
    .map((data) =>
      Object.entries(data).map(([code, definition]) => ({
        code,
        service,
        message: definition.description,
        metadata: {
          references: definition.references,
        },
      }))
    )
}

Subdomains

Called By

Frequently Asked Questions

What does doFetchErrorCodes() do?
doFetchErrorCodes() is a function in the supabase codebase.
What does doFetchErrorCodes() call?
doFetchErrorCodes() calls 6 function(s): extractMessageFromAnyError, flatMap, join, map, tryCatch, tryCatchSync.
What calls doFetchErrorCodes()?
doFetchErrorCodes() is called by 1 function(s): fetchErrorCodes.

Analyze Your Own Codebase

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

Try Supermodel Free