-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[error] Better error message for ExitErrors (#675)
## Summary This PR makes three changes: 1. Handles ExitErrors specially (for non `usererr.ExitError`) by printing the `err.Stderr` when `DEVBOX_DEBUG=1`. 2. When `DEVBOX_DEBUG=0`, we now include the command and also suggest to the user to run with DEVBOX_DEBUG=1 for a more detailed error and suggest reporting the bug. 3. Renames `usererr.UserExecError` to `usererr.ExitError` which more accurately represents what that struct is doing: the error is only wrapped if it is ExitError. ## How was it tested? in `testdata/unfree-packages`: BEFORE: ``` ❯ DEVBOX_FEATURE_FLAKES=1 DEVBOX_FEATURE_UNIFIED_ENV=1 DEVBOX_DEBUG=0 devbox shell Ensuring packages are installed. Ensuring nixpkgs registry is downloaded. Downloaded 'github:NixOS/nixpkgs/52e3e80afff4b16ccb7c52e9f0f5220552f03d04' to '/nix/store/j5a7i3dvxslg2ychfy53wdhg1m3xfrwm-source' (hash 'sha256-FqZ7b2RpoHQ/jlG6JPcCNmG/DoUPCIvyaropUDFhF3Q='). Ensuring nixpkgs registry is downloaded: Success Starting a devbox shell... Error: exit status 1 ``` AFTER: <img width="1239" alt="Screenshot 2023-02-23 at 1 21 30 PM" src="https://user-images.githubusercontent.com/676452/221033169-92c65573-a339-422d-8141-5ba9c58e0353.png"> and AFTER with DEBUG=1: <img width="1217" alt="Screenshot 2023-02-23 at 1 15 50 PM" src="https://user-images.githubusercontent.com/676452/221033213-ded4c288-7fec-425e-bf7e-7a75c5323f6a.png">
- Loading branch information
Showing
5 changed files
with
28 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters