Skip to content

Commit

Permalink
Rename field
Browse files Browse the repository at this point in the history
  • Loading branch information
eddy-aws authored and Steven Yuan committed Dec 28, 2022
1 parent 977440a commit a60daaa
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class StructureGenerator implements Runnable {
"ErrorMessage", "string",
"ErrorFault", "string"
);
private static final Set<String> ERROR_MEMBER_NAMES = SetUtils.of("ErrorMessage", "Message", "DynamicErrorCode");
private static final Set<String> ERROR_MEMBER_NAMES = SetUtils.of("ErrorMessage", "Message", "ErrorCodeOverride");

private final Model model;
private final SymbolProvider symbolProvider;
Expand Down Expand Up @@ -144,7 +144,7 @@ private void renderErrorStructure() {
// The message is the only part of the standard APIError interface that isn't known ahead of time.
// Message is a pointer mostly for the sake of consistency.
writer.write("Message *string").write("");
writer.write("DynamicErrorCode *string").write("");
writer.write("ErrorCodeOverride *string").write("");

for (MemberShape member : shape.getAllMembers().values()) {
String memberName = symbolProvider.toMemberName(member);
Expand Down Expand Up @@ -175,10 +175,10 @@ private void renderErrorStructure() {
String errorCode = protocolGenerator == null ? shape.getId().getName(service)
: protocolGenerator.getErrorCode(service, shape);
writer.openBlock("func (e *$L) ErrorCode() string {", "}", structureSymbol.getName(), () -> {
writer.openBlock("if e.DynamicErrorCode == nil {", "}", () -> {
writer.openBlock("if e.ErrorCodeOverride == nil {", "}", () -> {
writer.write("return $S", errorCode);
});
writer.write("return *e.DynamicErrorCode");
writer.write("return *e.ErrorCodeOverride");
});

String fault = "smithy.FaultUnknown";
Expand Down

0 comments on commit a60daaa

Please sign in to comment.