Skip to content

Commit

Permalink
Remove Codec. from error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Oct 27, 2023
1 parent 5a54155 commit 2471fa1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export function fieldsUnion<
maybeEncodedCommonField = encodedFieldName;
} else if (maybeEncodedCommonField !== encodedFieldName) {
throw new Error(
`Codec.fieldsUnion: Variant at index ${index}: Key ${JSON.stringify(
`fieldsUnion: Variant at index ${index}: Key ${JSON.stringify(
decodedCommonField,
)}: Got a different encoded field name (${JSON.stringify(
encodedFieldName,
Expand All @@ -252,7 +252,7 @@ export function fieldsUnion<

if (typeof maybeEncodedCommonField !== "string") {
throw new Error(
`Codec.fieldsUnion: Got unusable encoded common field: ${repr(
`fieldsUnion: Got unusable encoded common field: ${repr(
maybeEncodedCommonField,
)}`,
);
Expand Down
4 changes: 2 additions & 2 deletions tests/decoders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ describe("fieldsUnion", () => {
// Source has 0 element(s) but target requires 1.
fieldsUnion("tag", []),
).toThrowErrorMatchingInlineSnapshot(
'"Codec.fieldsUnion: Got unusable encoded common field: undefined"',
'"fieldsUnion: Got unusable encoded common field: undefined"',
);
});

Expand Down Expand Up @@ -675,7 +675,7 @@ describe("fieldsUnion", () => {
{ tag: tag("B", { renameFieldFrom: "type" }) },
]),
).toThrowErrorMatchingInlineSnapshot(
'"Codec.fieldsUnion: Variant at index 1: Key \\"tag\\": Got a different encoded field name (\\"type\\") than before (\\"tag\\")."',
'"fieldsUnion: Variant at index 1: Key \\"tag\\": Got a different encoded field name (\\"type\\") than before (\\"tag\\")."',
);
});

Expand Down

0 comments on commit 2471fa1

Please sign in to comment.