Skip to content

Commit a8d23df

Browse files
committed
More readable init errors
1 parent 4b6156e commit a8d23df

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arduino/cli/commander.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package cli
1919

2020
import (
2121
"context"
22+
"errors"
2223
"fmt"
2324
"os"
2425
"path/filepath"
@@ -52,7 +53,10 @@ func NewCommander() (arduino.Commander, error) {
5253
}
5354
errs := instance.Init(inst)
5455
if len(errs) > 0 {
55-
err = fmt.Errorf("initializing arduino-cli instance: %v", errs)
56+
err = errors.New("initializing arduino-cli instance: received errors: ")
57+
for _, e := range errs {
58+
err = fmt.Errorf("%w%v; ", err, e)
59+
}
5660
return nil, err
5761
}
5862

0 commit comments

Comments
 (0)