Skip to content

Commit

Permalink
chore: remove filterSensitiveLog for service exceptions (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Jan 11, 2022
1 parent 000909d commit e83e9b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ private void renderNonErrorStructure() {
* $fault: "client";
* resourceType: string | undefined;
* }
*
* export namespace NoSuchResource {
* export const filterSensitiveLog = (obj: NoSuchResource): any => ({...obj});
* }
* }</pre>
*/
private void renderErrorStructure() {
Expand All @@ -197,7 +193,6 @@ private void renderErrorStructure() {
structuredMemberWriter.writeMembers(writer, shape);
writer.closeBlock("}"); // interface
writer.write("");
renderStructureNamespace(structuredMemberWriter, false);
}

private void renderStructureNamespace(StructuredMemberWriter structuredMemberWriter, boolean includeValidation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import software.amazon.smithy.model.shapes.StringShape;
import software.amazon.smithy.model.shapes.StructureShape;
import software.amazon.smithy.model.traits.EnumTrait;
import software.amazon.smithy.model.traits.ErrorTrait;
import software.amazon.smithy.model.traits.IdempotencyTokenTrait;
import software.amazon.smithy.model.traits.LengthTrait;
import software.amazon.smithy.model.traits.MediaTypeTrait;
Expand Down Expand Up @@ -163,6 +164,9 @@ private void writeStructureFilterSensitiveLog(
} else if (structureTarget.hasTrait(StreamingTrait.class) && structureTarget.isUnionShape()) {
// disable logging for StreamingTrait
writer.write("'STREAMING_CONTENT'");
} else if (structureTarget.hasTrait(ErrorTrait.class)) {
// Sensitive logs are not filtered from errors.
writer.write("$L", structureParam);
} else {
// Call filterSensitiveLog on Structure.
writer.write("$T.filterSensitiveLog($L)", symbolProvider.toSymbol(structureTarget), structureParam);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ private void testErrorStructureCodegen(String file, String expectedType) {
String contents = testStructureCodegen(file, expectedType);

assertThat(contents, containsString("as __SmithyException"));
assertThat(contents, containsString("namespace Err {"));
}

@Test
Expand Down

0 comments on commit e83e9b3

Please sign in to comment.