@webpieces/rules-config 0.4.693 → 0.4.695

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/rules-config",
3
- "version": "0.4.693",
3
+ "version": "0.4.695",
4
4
  "description": "Shared webpieces.config.json loader. Single source of truth for validation rule configuration consumed by @webpieces/ai-hook-rules, @webpieces/code-rules, and @webpieces/nx-webpieces-rules.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -652,7 +652,27 @@ async submitForm(): Promise<void> {
652
652
 
653
653
  - **ONLY catch specific error types** (e.g., `HttpUserError`, `ValidationError`)
654
654
  - **ALWAYS rethrow** errors that aren't user-facing
655
- - The server-side code should throw `HttpUserError` for user-displayable messages
655
+ - Server-side code MUST throw `HttpUserError` for user-displayable messages
656
+
657
+ ### `HttpUserError` is not a convention — it is the only message that survives the wire
658
+
659
+ This is a HARD RULE, enforced by `HttpErrorWireMapper` on the server (`http-server`):
660
+
661
+ > **Only `HttpUserError`'s `message` is sent to the caller.** Every other `HttpError` subclass sends
662
+ > the generic HTTP reason phrase for its status — `'Not Found'`, `'Internal Server Error'`, … — and
663
+ > its real message goes to the server's LOG only.
664
+
665
+ `Error.message` is an operator-facing field. It routinely quotes a downstream service url, an HTTP
666
+ method and content-type, a body snippet, a table name or an internal id, and none of that may reach an
667
+ external consumer. So:
668
+
669
+ - Throwing `new HttpBadRequestError('the email you entered is already taken')` does **not** show that
670
+ text to the user — the caller receives `'Bad Request'`. Throw `HttpUserError` instead, or pass the
671
+ text as `HttpBadRequestError`'s `guiMessage`, which IS sent (as `guiAlertMessage`).
672
+ - A client must branch on the error TYPE, on `subType`, on `errorCode` or on `guiAlertMessage` — never
673
+ on the prose of `message`. Against a current webpieces server that prose is a constant per status.
674
+ - An app that deliberately wants to publish richer text registers an `ErrorTranslation` with
675
+ `ClientRegistry`; its `toWire()` result is sent verbatim. That is the explicit, greppable opt-out.
656
676
 
657
677
  ## How to Request Approval
658
678