runEffectPromise
runEffectPromise<
A,E>(effect):Promise<A>
Defined in: src/Runtime.ts:184
Run an Effect asynchronously and convert it to a Promise with clean error handling.
- Executes the Effect using
Effect.runPromiseExit - On failure, extracts the error and cleans stack traces
- Removes Effect.ts internal stack frames for cleaner error messages
- Throws the cleaned error for standard Promise error handling
Type Parameters
A
A
E
E
Parameters
effect
Effect<A, E>
Returns
Promise<A>
Example
import { Effect } from 'effect';import * as Midday from '@no-witness-labs/midday-sdk';
const myEffect = Effect.tryPromise(() => fetch('/api'));
async function example() { try { const result = await Midday.Runtime.runEffectPromise(myEffect); console.log(result); } catch (error) { console.error(error); }}Since
0.3.0