tryCatch

Attempts to execute a promise and returns an array with the result or error.

This is useful for handling errors in async functions without try/catch blocks.

Example