Skip to content

Commit 460cef2

Browse files
authored
Set errorCode correctly in default case (#132)
* chore: remove UnknownError assignment Reason: It's initialized to "UnknownError" on line 268 * fix: set errorCode to parsedBody.code in default case * chore: use errorLocation instead of parsedBody
1 parent eccc2a5 commit 460cef2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpProtocolGeneratorUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ static Set<StructureShape> generateErrorDispatcher(
295295

296296
// Get the protocol specific error location for retrieving contents.
297297
String errorLocation = bodyErrorLocationModifier.apply(context, "parsedBody");
298-
writer.write("errorCode = errorCode || \"UnknownError\";");
298+
writer.write("errorCode = $1L.code || $1L.Code || errorCode;", errorLocation);
299299
writer.openBlock("response = {", "} as any;", () -> {
300300
writer.write("...$L,", errorLocation);
301301
writer.write("name: `$${errorCode}`,");

0 commit comments

Comments
 (0)