Skip to content

Commit

Permalink
fix: handle multiline errors that might happen with kurtosis clean (#69)
Browse files Browse the repository at this point in the history
handle multiline errors that might happen with kurtosis clean
  • Loading branch information
h4ck3rk3y committed Mar 1, 2023
1 parent d0f15f9 commit f7400be
Showing 1 changed file with 5 additions and 3 deletions.
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 @@ -292,12 +293,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

0 comments on commit f7400be

Please sign in to comment.