diff options
author | Elizabeth Hunt <elizabeth@simponic.xyz> | 2025-03-01 12:36:47 -0700 |
---|---|---|
committer | Elizabeth Hunt <elizabeth@simponic.xyz> | 2025-03-01 12:36:47 -0700 |
commit | 8dacee8f73633131fd68935c1e2493dc4beec837 (patch) | |
tree | fc9adf76fce4761b01208ba2f44e72a6838244aa /src/engine/utils/tryWrap.ts | |
parent | d903bd9a13e790cf42c84c3dc59bf89ffeae1d80 (diff) | |
download | the-abstraction-engine-8dacee8f73633131fd68935c1e2493dc4beec837.tar.gz the-abstraction-engine-8dacee8f73633131fd68935c1e2493dc4beec837.zip |
updates
Diffstat (limited to 'src/engine/utils/tryWrap.ts')
-rw-r--r-- | src/engine/utils/tryWrap.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/engine/utils/tryWrap.ts b/src/engine/utils/tryWrap.ts new file mode 100644 index 0000000..12e23ea --- /dev/null +++ b/src/engine/utils/tryWrap.ts @@ -0,0 +1,7 @@ +export const tryWrap = <T>(supplier: () => T): { data?: T; error?: any } => { + try { + return { data: supplier() }; + } catch (error) { + return { error: error as any }; + } +}; |