Forcing a Specific Failure Type More Elegantly

When I want to force a failure of a certain type, at the moment, I am writing this somewhat redundant code, to make sure both the success path and the failure path are forced onto the same failure path.

    Effect.tapBoth({
      onSuccess: () => E.fail('blahblah error'),
      onFailure: () => E.fail('blahblah error'),
    })


Is there a more elegant way to do this? Something like Effect.failWith(() => 'blahblah error')
Was this page helpful?