private StructureShape createNewError(StructureShape oldError, Map<String, HttpHeaderTrait> headerMap) {
        StructureShape.Builder newErrorBuilder = oldError.toBuilder().clearMembers();
        for (MemberShape member : oldError.getAllMembers().values()) {
            String name = member.getMemberName();
            // Collect HttpHeaderTraits to hoist.
            if (member.hasTrait(HttpHeaderTrait.ID)) {
                HttpHeaderTrait newTrait = member.expectTrait(HttpHeaderTrait.class);
                HttpHeaderTrait previousTrait = headerMap.put(name, newTrait);
                if (previousTrait != null && !previousTrait.equals(newTrait)) {
                    throw new ModelTransformException("Conflicting header when de-conflicting");
                }
            } else {
                newErrorBuilder.addMember(member.toBuilder().id(newErrorBuilder.getId().withMember(name)).build());
            }
        }
        return newErrorBuilder.build();
    }
Deconflicts errors on operations that share the same status code by replacing
the conflicting errors with a synthetic error structure that contains hoisted
members that were bound to HTTP headers. The conflicting errors are added to
a union on the synthetic error.
smithy-model/src/main/java/software/amazon/smithy/model/transform/DeconflictErrorsWithSharedStatusCode.java