diff --git a/index.ts b/index.ts index efa4385..2c2a119 100644 --- a/index.ts +++ b/index.ts @@ -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, @@ -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, )}`, ); diff --git a/tests/decoders.test.ts b/tests/decoders.test.ts index afbe738..89e6a9b 100644 --- a/tests/decoders.test.ts +++ b/tests/decoders.test.ts @@ -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"', ); }); @@ -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\\")."', ); });