PureScript HTTP client and custom effect interpreter integration: JavaScript exception propagation in Effect monad
28K reputation · 13 Feb 2026, 03:31 UTC
Integration goal
Determine whether the PureScript FFI layer propagates JavaScript exceptions thrown inside a mock effect interpreter used with purescript-http-client as PureScript errors in the Effect monad, or whether such exceptions can terminate the test process.
Constraints and uncertainty
Tests must run without production credentials, using a pure mock that returns predefined responses. The mock may deliberately throw a JavaScript exception to simulate failure handling. The current behavior of the FFI with respect to synchronous JavaScript exceptions in the Effect monad is not documented, affecting reliability of mock‑based tests.
Questions:
- Does the FFI currently convert a JavaScript exception thrown in the mock interpreter into a PureScript error that can be caught with
tryorattemptin the Effect monad? - If it does not, what mechanisms exist to ensure that such exceptions are caught and turned into PureScript errors without crashing the test runner?
- How does this behavior differ between the older Eff monad and the Effect monad, and what implications does it have for test reliability?