• Whether err is one of the engine-unavailable failures the package's construct paths raise, narrowed so err.code — and err.message — are readable without a cast.

    causl/causl-wasm-ts#363 finding 8 — the errors the package's headline factory can throw for an unreachable engine are raised from two different CLASSES on two sides of the bundle seam (the main bundle must not name a @causl/causl-wasm-ts/wasm symbol, so it cannot extend the subpath's class). instanceof therefore cannot be the adopter's test for WHICH engine failure this is, which is why the barrel's contract says to branch on the tagged identity — and until this guard existed the tagged identity was not exported in any form.

    Reads the code rather than the class for exactly that reason, and admits a subclass thrown by the subpath without importing it.

    NOT the only failure createCausl() raises. createCausl({ engine }) — or any of the four options 0.5.0 removed — throws import('./errors.js').RemovedEngineOptionError (CAUSL_REMOVED_ENGINE_OPTION), which this guard deliberately refuses: it is a defect in the CALL, not a statement about the engine's reachability, and a catch that treated the two alike would tell an adopter to go and preload when the fix is to delete a key. import('./errors.js').isRemovedEngineOption is its guard.

    Parameters

    • err: unknown

    Returns err is Error & { code: CauslEngineErrorCode }

    causl/causl-wasm-ts#363 — the instanceof Error test is load-bearing and is NOT a redundant restatement of the return type. The predicate PROMISES Error &, so every caller it narrows for is entitled to read err.message; without the test, a plain { code: 'CAUSL_WASM_ENGINE_UNAVAILABLE' } — precisely what a catch (err: unknown) receives across a worker / postMessage / JSON-relay boundary, where the class does not survive — satisfied the guard, type-checked clean at the call site, and threw a foreign TypeError on the first property read inside the branch. Refusing that shape is the honest answer: it is a RECORD of an engine failure, not the failure, and the handler this guard exists to write cannot render it.