@adcp/sdk API Reference - v7.9.0
    Preparing search index...

    Function expectControllerError

    • Narrow a ComplyTestControllerResponse to the ControllerError arm and assert its error code. Throws an Error with a descriptive message when the response is success-shaped or when the code does not match.

      Returns the narrowed error so callers can make further assertions on error_detail / current_state without re-casting.

      const result = await handleTestControllerRequest(store, {
      scenario: 'force_account_status',
      params: {},
      });
      const err = expectControllerError(result, 'INVALID_PARAMS');
      assert.match(err.error_detail, /account_id/);

      Parameters

      • result: ComplyTestControllerResponse
      • code:
            | "INVALID_STATE"
            | "INVALID_TRANSITION"
            | "NOT_FOUND"
            | "UNKNOWN_SCENARIO"
            | "INVALID_PARAMS"
            | "FORBIDDEN"
            | "INTERNAL_ERROR"

      Returns ControllerErrorWithDetail