Skip to content

runEffect

runEffect<A, E>(effect): A

Defined in: src/Runtime.ts:144

Run an Effect synchronously with clean error handling.

  • Executes the Effect using Effect.runSyncExit
  • 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 error handling

Type Parameters

A

A

E

E

Parameters

effect

Effect<A, E>

Returns

A

Example

import { Effect } from 'effect';
import * as Midday from '@no-witness-labs/midday-sdk';
const myEffect = Effect.succeed(42);
try {
const result = Midday.Runtime.runEffect(myEffect);
console.log(result);
} catch (error) {
// Error with clean stack trace, no Effect.ts internals
console.error(error);
}

Since

0.3.0