Fix/shared unknown attachment error - #642
Open
abhayrajjais01 wants to merge 10 commits into
Open
Conversation
…tDescriptor payloads Signed-off-by: abhayrajjais01 <abhayrajjais01@users.noreply.github.com>
Remove Buffer setup code for testing environment. Signed-off-by: Abhayraj Jaiswal <abhayraj916146@gmail.com>
Remove unnecessary comment from setup file. Signed-off-by: Abhayraj Jaiswal <abhayraj916146@gmail.com>
Closed
6 tasks
elribonazo
requested changes
May 20, 2026
| @@ -0,0 +1,2 @@ | |||
|
|
|||
Signed-off-by: Abhayraj Jaiswal <abhayraj916146@gmail.com>
elribonazo
requested changes
May 20, 2026
| @@ -0,0 +1 @@ | |||
| // intentionally empty – required by vitest.config.js setupFiles | |||
Contributor
There was a problem hiding this comment.
Don't create / commit the file please...
Signed-off-by: Abhayraj Jaiswal <abhayraj916146@gmail.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
AttachmentDescriptor.extractJSONthrew a genericError("Unhandled attachment")for payloads that were neither valid base64 JSON nor a recognizablejsonattachment shape. The domain layer already definesMercuryError.UnknownAttachmentDataError, but this path did not use it, so callers could not reliably branch on Mercury’s typed errors.This PR throws
UnknownAttachmentDataErrorfrom that fallback path with a short message describing the expected shapes, and adds a Vitest regression test (header-only attachment data) that expectsMercuryError.UnknownAttachmentDataError.Files:
packages/shared/domain/src/models/MessageAttachment.ts,packages/shared/domain/tests/setup.ts,packages/shared/domain/tests/MessageAttachment.test.ts.Alternatives Considered (optional)
Error: Preserves oldinstanceof Errorbehavior but loses the domain error type and is inconsistent with existingMercuryerror classes.UnknownAttachmentDataErroralready matches the semantic.Checklist