You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2026/10/12 10:49:42 UTC

(mynewt-newt) 06/09: newt/cli: Fix panic on non-newt test errors

This is an automated email from the ASF dual-hosted git repository.

sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git

commit 7e7bd91f02bf4c58915f096876e0dfc8c672bcf1
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Fri Oct 9 15:12:10 2026 +0200

    newt/cli: Fix panic on non-newt test errors
    
    Test failures were assumed to always be *util.NewtError, e.g. a
    failing os.Chdir before running the test binary caused a panic.
    Print the error message regardless of its type.
    
    Assisted-by: Claude:claude-opus-5-5
---
 newt/cli/build_cmds.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/newt/cli/build_cmds.go b/newt/cli/build_cmds.go
index d0c1fccc..2431850d 100644
--- a/newt/cli/build_cmds.go
+++ b/newt/cli/build_cmds.go
@@ -358,8 +358,7 @@ func testRunCmd(cmd *cobra.Command, args []string, exclude string, executeShell
 		if err == nil {
 			passedPkgs = append(passedPkgs, pack)
 		} else {
-			newtError := err.(*util.NewtError)
-			util.StatusMessage(util.VERBOSITY_QUIET, newtError.Text)
+			util.StatusMessage(util.VERBOSITY_QUIET, "%s", err.Error())
 			failedPkgs = append(failedPkgs, pack)
 		}
 	}