mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-04 07:15:05 -04:00
cli: remove ctx parameter from rollbackOnError to prevent wrong use
This commit is contained in:
parent
4d618a4b99
commit
43fbb06426
3 changed files with 10 additions and 10 deletions
|
@ -20,13 +20,13 @@ type rollbacker interface {
|
|||
|
||||
// rollbackOnError calls rollback on the rollbacker if the handed error is not nil,
|
||||
// and writes logs to the writer w.
|
||||
func rollbackOnError(ctx context.Context, w io.Writer, onErr *error, roll rollbacker) {
|
||||
func rollbackOnError(w io.Writer, onErr *error, roll rollbacker) {
|
||||
if *onErr == nil {
|
||||
return
|
||||
}
|
||||
fmt.Fprintf(w, "An error occurred: %s\n", *onErr)
|
||||
fmt.Fprintln(w, "Attempting to roll back.")
|
||||
if err := roll.rollback(ctx); err != nil {
|
||||
if err := roll.rollback(context.Background()); err != nil {
|
||||
*onErr = errors.Join(*onErr, fmt.Errorf("on rollback: %w", err)) // TODO: print the error, or return it?
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue