Skip to content

fix(errors): support documented (message, properties) signature in ValidationFailedError and AssertionFailedError - #48

Open
mertcano wants to merge 1 commit into
uphold:masterfrom
mertcano:mertcano-patch-1
Open

mertcano wants to merge 1 commit into
uphold:masterfrom
mertcano:mertcano-patch-1

Conversation

@mertcano

@mertcano mertcano commented Oct 8, 2026

Copy link
Copy Markdown

Summary of Changes

Resolves F18 (Medium) from the Uphold Workspace Security & Code Quality Audit:

  • Constructor Contract Alignment (F18):
    • Updated ValidationFailedError (400) and AssertionFailedError (500) constructors to evaluate argument arity.
    • When two or more arguments are provided, super(status, ...args) is called to satisfy the documented (message, properties) signature without discarding caller properties.
    • Preserved single-argument compatibility for callers supplying an isolated errors violation tree (e.g. http-request-signature).
  • Regression Coverage & Docs:
    • Added test cases in assertion-failed-error_test.js and validation-failed-error_test.js verifying message and property mapping.
    • Documented the dual signature behaviour in README.md.

Verification

  • node --test test/**/*.js passes with 58 passing tests and 0 failures.

…lidationFailedError and AssertionFailedError

### Summary of Changes
Resolves **F18 (Medium)** from the Uphold Workspace Security & Code Quality Audit:

- **Constructor Contract Alignment (F18):**
  - Updated `ValidationFailedError` (400) and `AssertionFailedError` (500) constructors to evaluate argument arity.
  - When two or more arguments are provided, `super(status, ...args)` is called to satisfy the documented `(message, properties)` signature without discarding caller properties.
  - Preserved single-argument compatibility for callers supplying an isolated `errors` violation tree (e.g. `http-request-signature`).
- **Regression Coverage & Docs:**
  - Added test cases in `assertion-failed-error_test.js` and `validation-failed-error_test.js` verifying message and property mapping.
  - Documented the dual signature behaviour in `README.md`.

### Verification
- `node --test test/**/*.js` passes with 58 passing tests and 0 failures.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant