Skip to content

Classify validation failures into specific exception types#515

Open
marcoscaceres wants to merge 4 commits into
mainfrom
classify-validation-errors
Open

Classify validation failures into specific exception types#515
marcoscaceres wants to merge 4 commits into
mainfrom
classify-validation-errors

Conversation

@marcoscaceres

@marcoscaceres marcoscaceres commented May 13, 2026

Copy link
Copy Markdown
Collaborator

Closes #472.

Replaces "throw an appropriate exception" in Validate credential requests with a switch that maps each class of validation failure to a concrete exception type, matching the style of the platform-error switch in Initiate the credential request:

  • Malformed/invalid request data → TypeError
  • Otherwise → "OperationError" DOMException

Also clarifies the accompanying prose to separate what counts as a validation failure (protocol-specific) from how such a failure is classified into an exception type (in-scope).

Without this, implementations have no shared rule and WPT can only assert "some exception."

cc @w3c-fedid/dc-editors

The following tasks have been completed:

  • Modified Web platform tests (follow-up — WPT tests exercising this classification are in flight on the WPT side)

Implementation commitment:

  • WebKit (follow-up)
  • Chromium (follow-up)
  • Gecko (follow-up)

Documentation and checks

  • Affects privacy
  • Affects security
  • Pinged MDN
  • Updated Explainer
  • Updated digitalcredentials.dev

Preview | Diff

Replaces "throw an appropriate exception" in `Validate credential
requests` with a switch that maps each class of validation failure
to a concrete exception type, mirroring the platform-error switch in
`Initiate the credential request`:

- Malformed/invalid request data → `TypeError`
- Otherwise → `"OperationError"` `DOMException`

Also clarifies the accompanying prose to separate what counts as a
validation failure (protocol-specific) from how such a failure is
classified into an exception type (in-scope).

Closes #472

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@marcoscaceres marcoscaceres requested a review from a team as a code owner May 13, 2026 06:50

@mohamedamir mohamedamir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcoscaceres as per our discussion, LGTM

@marcoscaceres marcoscaceres requested a review from timcappalli May 14, 2026 21:37
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.

User agent request validation and errors

2 participants