API Reference / @evolu/common / Assert / assertNoErrorInCatch

Function: assertNoErrorInCatch()

function assertNoErrorInCatch(context, error): never;

Defined in: packages/common/src/Assert.ts:109

Asserts no error reaches a .catch block, throwing a developer error if it does. Used in Promise chains where errors indicate bugs to be fixed.

Example

Promise.reject("test").catch((e) =>
  assertNoErrorInCatch("WebSocket retry", e),
);

Parameters

ParameterType
contextstring
errorunknown

Returns

never

Was this page helpful?