Skip to content

fix(error): avoid override errors on rollback#16

Open
balanza wants to merge 1 commit into89luca89:mainfrom
balanza:do-not-shadow-errors
Open

fix(error): avoid override errors on rollback#16
balanza wants to merge 1 commit into89luca89:mainfrom
balanza:do-not-shadow-errors

Conversation

@balanza
Copy link
Copy Markdown

@balanza balanza commented Apr 17, 2026

Redeclare err in the rollback() scope so that it does not override the outer scope.

Example

if err != nil {
	rollback()
	return "", fmt.Errorf("start sidecar: %w", err)
}
# before
level=INFO msg="Error: start sidecar: %!w(<nil>)"

# after
level=INFO msg="Error: start sidecar: exit status 126"

Redeclare `err` in the `rollback()` scope so that it does not override
the outer scope.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant