Skip to content
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

fix: handle multiline errors that might happen with kurtosis clean #69

Merged
merged 2 commits into from Mar 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions engine/server/engine/enclave_manager/enclave_manager.go
Expand Up @@ -2,6 +2,7 @@ package enclave_manager

import (
"context"
"fmt"
"github.com/kurtosis-tech/kurtosis/api/golang/engine/kurtosis_engine_rpc_api_bindings"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_manager/types"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface"
Expand Down Expand Up @@ -297,12 +298,13 @@ func (manager *EnclaveManager) Clean(ctx context.Context, shouldCleanAll bool) (
if len(removalErrors) > 0 {
logrus.Errorf("Errors occurred removing the following enclaves")
var removalErrorStrings []string
for _, err = range removalErrors {
for idx, err := range removalErrors {
logrus.Errorf("Error '%v'", err.Error())
removalErrorStrings = append(removalErrorStrings, err.Error())
indexedResultErrStr := fmt.Sprintf(">>>>>>>>>>>>>>>>> ERROR %v <<<<<<<<<<<<<<<<<\n%v", idx, err.Error())
removalErrorStrings = append(removalErrorStrings, indexedResultErrStr)
}
joinedRemovalErrors := strings.Join(removalErrorStrings, errorDelimiter)
return nil, stacktrace.NewError("Following errors occurred while removing some enclaves '%v'", joinedRemovalErrors)
return nil, stacktrace.NewError("Following errors occurred while removing some enclaves :\n%v", joinedRemovalErrors)
}

if len(successfullyRemovedArtifactIds) > 0 {
Expand Down