Skip to content

Commit f24c2c9

Browse files
author
rsora
committed
Error messages cosmetics
1 parent c0c0099 commit f24c2c9

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

commands/daemon/debug.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616
package daemon
1717

1818
import (
19-
"fmt"
20-
2119
"github.com/arduino/arduino-cli/arduino/utils"
2220
cmd "github.com/arduino/arduino-cli/commands/debug"
2321
dbg "github.com/arduino/arduino-cli/rpc/debug"
22+
"github.com/pkg/errors"
2423
)
2524

2625
// DebugService implements the `Debug` service
@@ -40,7 +39,7 @@ func (s *DebugService) Debug(stream dbg.Debug_DebugServer) error {
4039
// Ensure it's a config message and not data
4140
req := msg.GetDebugReq()
4241
if req == nil {
43-
return fmt.Errorf("First message must contain debug request, not data")
42+
return errors.Errorf("First message must contain debug request, not data")
4443
}
4544

4645
// Launch debug recipe attaching stdin and out to grpc streaming

commands/debug/debug.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package debug
1818
import (
1919
"context"
2020
"fmt"
21+
"github.com/pkg/errors"
2122
"io"
2223
"os"
2324
"path/filepath"
@@ -47,19 +48,18 @@ func Debug(ctx context.Context, req *dbg.DebugConfigReq, inStream io.Reader, out
4748
pm := commands.GetPackageManager(req.GetInstance().GetId())
4849
commandLine, err := getCommandLine(req, pm)
4950
if err != nil {
50-
return nil, fmt.Errorf("cannot get command line for tool: %s", err)
51+
return nil, errors.Wrap(err, "Cannot get command line for tool")
5152
}
5253

5354
// Run Tool
5455
cmd, err := executils.Command(commandLine)
5556
if err != nil {
56-
return nil, fmt.Errorf("cannot execute debug tool: %s", err)
57+
return nil, errors.Wrap(err, "Cannot execute debug tool")
5758
}
5859

5960
// Get stdIn pipe from tool
6061
in, err := cmd.StdinPipe()
6162
if err != nil {
62-
fmt.Printf("%v\n", err)
6363
return &dbg.DebugResp{Error: err.Error()}, nil
6464
}
6565
defer in.Close()
@@ -70,7 +70,6 @@ func Debug(ctx context.Context, req *dbg.DebugConfigReq, inStream io.Reader, out
7070

7171
// Start the debug command
7272
if err := cmd.Start(); err != nil {
73-
fmt.Printf("%v\n", err)
7473
return &dbg.DebugResp{Error: err.Error()}, nil
7574
}
7675

0 commit comments

Comments
 (0)