Home / Function/ tryCatch() — supabase Function Reference

tryCatch() — supabase Function Reference

Architecture documentation for the tryCatch() function in helpers.fn.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  a7b13147_1b94_5dbe_3036_8c86489e129c["tryCatch()"]
  dc251b6d_906f_6c94_fad9_efde7dffb5a6["doFetchErrorCodes()"]
  dc251b6d_906f_6c94_fad9_efde7dffb5a6 -->|calls| a7b13147_1b94_5dbe_3036_8c86489e129c
  46d218d1_4c2d_c813_f0c6_3dc0d7dce1f0["walkMdxFiles()"]
  46d218d1_4c2d_c813_f0c6_3dc0d7dce1f0 -->|calls| a7b13147_1b94_5dbe_3036_8c86489e129c
  eb1b33c7_935b_b61a_962a_2e11b76d01bc["fromFs()"]
  eb1b33c7_935b_b61a_962a_2e11b76d01bc -->|calls| a7b13147_1b94_5dbe_3036_8c86489e129c
  2373fead_7dbc_efa1_871c_2e08f6c27649["ok()"]
  a7b13147_1b94_5dbe_3036_8c86489e129c -->|calls| 2373fead_7dbc_efa1_871c_2e08f6c27649
  1ee162b1_d232_4846_ef61_0018a3d5f851["error()"]
  a7b13147_1b94_5dbe_3036_8c86489e129c -->|calls| 1ee162b1_d232_4846_ef61_0018a3d5f851
  style a7b13147_1b94_5dbe_3036_8c86489e129c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/features/helpers.fn.ts lines 57–67

  static async tryCatch<Ok, Error, Args extends Array<unknown>>(
    fn: (...args: Args) => Promise<Ok>,
    onError: (error: unknown) => Error,
    ...args: Args
  ): Promise<Result<Ok, Error>> {
    try {
      return Result.ok(await fn(...args))
    } catch (error: unknown) {
      return Result.error(onError(error))
    }
  }

Subdomains

Calls

Frequently Asked Questions

What does tryCatch() do?
tryCatch() is a function in the supabase codebase.
What does tryCatch() call?
tryCatch() calls 2 function(s): error, ok.
What calls tryCatch()?
tryCatch() is called by 3 function(s): doFetchErrorCodes, fromFs, walkMdxFiles.

Analyze Your Own Codebase

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

Try Supermodel Free