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

Return original error type #194

Closed
wants to merge 8 commits into from
Closed

Conversation

lpusok
Copy link
Contributor

@lpusok lpusok commented Mar 20, 2024

Shove the original command error in the error tree. This allows checking for the specific exit code by code like this:

	var exitError *exec.ExitError
	if errors.As(err, &exitError) {

wrapError did not do this, breaking code expecting the above to work. This is fixed by using a feature in go 1.20 that allows wrapping multiple errors. (https://tip.golang.org/doc/go1.20#errors)

Output on go >= 1.20:

Run: failed to shutdown Simulator, command execution failed: command failed with exit status 149 (xcrun "simctl" "shutdown" "216F1ECE-9545-4CDD-A706-199C432EA348"): check the command's output for details 

Output on go < 1.20:

Run: failed to shutdown Simulator, command execution failed: command failed with exit status 149 (xcrun "simctl" "shutdown" "D519202A-FCD1-496C-AFCC-134697A128C8"): check the command's output for details %!w(*errorutil.HiddenOriginalError=&{0x140000e67a0})

@lpusok lpusok changed the title Aci 1834 return original error type Return original error type Mar 20, 2024
@lpusok lpusok requested review from godrei and tothszabi March 20, 2024 16:28
@lpusok lpusok closed this May 15, 2024
@lpusok lpusok deleted the ACI-1834-return-original-error-type branch May 16, 2024 13:28
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