private OperationShape.Builder transformErrors(
            Set<ShapeId> removed,
            OperationShape operation,
            OperationShape.Builder builder
    ) {
        Set<ShapeId> errors = new HashSet<>(operation.getErrors());
        errors.removeAll(removed);

        if (errors.size() != operation.getErrors().size()) {
            if (builder == null) {
                builder = operation.toBuilder();
            }
            builder.errors(errors);
            return builder;
        }

        return builder;
    }
Removes references to removed structures from operation
input, output, and errors.
smithy-model/src/main/java/software/amazon/smithy/model/transform/plugins/CleanOperationStructures.java