Skip to content

set errorCode before deser #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static Set<StructureShape> generateErrorDispatcher(
writer.addImport("MetadataBearer", "__MetadataBearer",
TypeScriptDependency.AWS_SDK_TYPES.packageName);
writer.write("let response: __SmithyException & __MetadataBearer;");
writer.write("let errorCode: String;");
writer.write("let errorCode: String = \"UnknownError\";");
errorCodeGenerator.accept(context);
writer.openBlock("switch (errorCode) {", "}", () -> {
// Generate the case statement for each error, invoking the specific deserializer.
Expand All @@ -173,7 +173,6 @@ static Set<StructureShape> generateErrorDispatcher(

// Build a generic error the best we can for ones we don't know about.
writer.write("default:").indent()
.write("errorCode = errorCode || \"UnknownError\";")
.openBlock("response = {", "};", () -> {
writer.write("__type: `$L#$${errorCode}`,", operation.getId().getNamespace());
writer.write("$$fault: \"client\",");
Expand Down