Effect CommunityEC
Effect Community3y ago
11 replies
bug

Preserving Error Cause in Effect.runPromise

Howdy. Where is my error cause going during runPromise? how can i preserve it?

import { Effect, pipe } from 'effect'

const oe = new Error('Err', { cause: new Error('Cause') })
console.log(oe)

void Effect.runPromise(
  pipe(
    Effect.fail(oe),
    Effect.tapError(e => Effect.sync(() => console.log('word2', e))),
  ),
).catch(e => console.log('word3', e))


outputs: https://gist.github.com/kn0ll/83b1e73f9ca0aef83fe54e6894f1ce64 (error with cause twice, then finally that error without cause)
Was this page helpful?