From 44058b28a20b45931a6bf0f01322fa64730d4b9c Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Thu, 2 Jan 2020 10:56:12 +0100 Subject: [PATCH 1/3] Improve error message on build failure --- cli/compile/compile.go | 9 +++++++-- commands/compile/compile.go | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cli/compile/compile.go b/cli/compile/compile.go index 84514062e60..c6072476f0a 100644 --- a/cli/compile/compile.go +++ b/cli/compile/compile.go @@ -19,6 +19,7 @@ package compile import ( "context" + "fmt" "os" "github.com/arduino/arduino-cli/cli/feedback" @@ -88,7 +89,7 @@ func NewCommand() *cobra.Command { func run(cmd *cobra.Command, args []string) { inst, err := instance.CreateInstance() if err != nil { - feedback.Errorf("Error during build: %v", err) + feedback.Errorf("Error creating instance: %v", err) os.Exit(errorcodes.ErrGeneric) } @@ -116,7 +117,11 @@ func run(cmd *cobra.Command, args []string) { }, os.Stdout, os.Stderr, viper.GetString("logging.level") == "debug") if err != nil { - feedback.Errorf("Error during build: %v", err) + errMsg := "Error during build" + if err.Error() != "" { + errMsg = fmt.Sprintf("%s: %v", errMsg, err) + } + feedback.Errorf("%s.", errMsg) os.Exit(errorcodes.ErrGeneric) } diff --git a/commands/compile/compile.go b/commands/compile/compile.go index b3ea4fe9318..9b2ecdfaa89 100644 --- a/commands/compile/compile.go +++ b/commands/compile/compile.go @@ -163,7 +163,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W // if it's a regular build, go on... if err := builder.RunBuilder(builderCtx); err != nil { - return nil, fmt.Errorf("build failed: %s", err) + return nil, err } // FIXME: Make a function to obtain these info... From e0d36cf9a1a7890aae9be8915cc1dbeedd9f60b5 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Thu, 2 Jan 2020 17:34:04 +0100 Subject: [PATCH 2/3] remove hack to ignore empty errors --- cli/compile/compile.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cli/compile/compile.go b/cli/compile/compile.go index c6072476f0a..3491ef7afb5 100644 --- a/cli/compile/compile.go +++ b/cli/compile/compile.go @@ -19,7 +19,6 @@ package compile import ( "context" - "fmt" "os" "github.com/arduino/arduino-cli/cli/feedback" @@ -117,11 +116,7 @@ func run(cmd *cobra.Command, args []string) { }, os.Stdout, os.Stderr, viper.GetString("logging.level") == "debug") if err != nil { - errMsg := "Error during build" - if err.Error() != "" { - errMsg = fmt.Sprintf("%s: %v", errMsg, err) - } - feedback.Errorf("%s.", errMsg) + feedback.Errorf("Error during build: %v", err) os.Exit(errorcodes.ErrGeneric) } From 966fcab8d3d5ade2e6727049d7b55e04bb7e646b Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Thu, 2 Jan 2020 17:34:16 +0100 Subject: [PATCH 3/3] properly report an error message --- legacy/builder/phases/sizer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/legacy/builder/phases/sizer.go b/legacy/builder/phases/sizer.go index 271d8d147c9..71bf5986fd6 100644 --- a/legacy/builder/phases/sizer.go +++ b/legacy/builder/phases/sizer.go @@ -105,12 +105,12 @@ func checkSize(ctx *types.Context, buildProperties *properties.Map) error { if textSize > maxTextSize { logger.Println(constants.LOG_LEVEL_ERROR, constants.MSG_SIZER_TEXT_TOO_BIG) - return errors.New("") + return errors.New("text section exceeds available space in board") } if maxDataSize > 0 && dataSize > maxDataSize { logger.Println(constants.LOG_LEVEL_ERROR, constants.MSG_SIZER_DATA_TOO_BIG) - return errors.New("") + return errors.New("data section exceeds available space in board") } if properties.Get(constants.PROPERTY_WARN_DATA_PERCENT) != "" { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy