diff --git a/CHANGELOG.md b/CHANGELOG.md index 52480e8..e16262e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ ## Unreleased +- `client.modules.call` resolves to `CallModuleFunctionClientResponse`, which + carries only `result`. Console output, the kernel call log and `error` are + no longer part of the player response; they stay on the platform dry run. +- Module business errors reject with `RudderHttpError` (`status` 422, body + `{ error, code, requestId }`). `code` is defined by the module and is an + open string. +- `RudderErrorCodes` and the `RudderErrorCode` type are no longer exported + from the package. The generated platform codes are now only `forbidden` and + `row_referenced`; the scenario and quest codes (`early_completion`, + `level_not_reached`, `node_not_active`, `objectives_incomplete`, + `run_expired`, `run_not_active`, `scenario_not_active`, `unknown_run`) are + removed with those domains. Compare `error.code` with string literals. - Login and token refresh send `platform: 'web'` and, when the new optional `appVersion` client option is set, `appVersion`. The backend stores them on the player for segment rules (`player.platform`, `player.appVersion`). diff --git a/README.md b/README.md index 3153163..7840ee7 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,10 @@ try { } ``` +A module business error rejects with `RudderHttpError` (`status` 422) whose +`code` is the module's own open string code. The platform codes are +`forbidden` and `row_referenced`. + Invalid client options (missing `baseUrl` / `projectKey`) throw `RudderError` with `code: 'sdk/invalid-options'` from the constructor. diff --git a/skills/rudder-web-sdk/SKILL.md b/skills/rudder-web-sdk/SKILL.md index 45e3e35..1583cd2 100644 --- a/skills/rudder-web-sdk/SKILL.md +++ b/skills/rudder-web-sdk/SKILL.md @@ -83,7 +83,7 @@ Tokens are saved to the `TokenStore` automatically. The transport injects | Catalog currencies | `client.catalog` | observable `SyncedState>` | | Player storage | `client.storage` + `.save(items)` / `.delete(type)` | observable + mutations | | Project storage | `client.projectStorage` + `.save(items)` | observable + mutation | -| Modules | `client.modules.call(module, fn, args?)` | `CallModuleFunctionResponse` | +| Modules | `client.modules.call(module, fn, args?)` | `CallModuleFunctionClientResponse` (`{ result }`) | | Resources | `client.resources(slug)` | `list` / `get` / `create` / `update` / `delete` | There is no UGC, wallet service, or standalone economy service — wallets live @@ -121,8 +121,16 @@ All SDK errors extend `RudderError` (optional machine-readable `code`): - `RudderError` with `code: 'sdk/invalid-options'` (`SDK_ERROR_INVALID_OPTIONS`) — constructor validation -Server error codes (`RudderErrorCodes`, from `src/generated/errors.ts`) are -compared with `error.code === RudderErrorCodes.forbidden`. +The platform error codes are `forbidden` and `row_referenced` +(`src/generated/errors.ts`, not exported from the package entry); compare +`error.code === 'forbidden'`. + +`client.modules.call` resolves to `{ result }` only; console output and the +kernel call log never reach players. A module business error rejects with +`RudderHttpError` whose `status` is 422 and whose `code` is the module's own +code (the body is `{ error, code, requestId }`). Module codes are open strings +with no generated constants, so compare against the codes the module +documents. A module trap is a 500 and a timeout a 504, both without details. ## Reference files