Skip to content

Commit f364683

Browse files
Propagate underlying error of TouchSerialPortAt1200bps (#18)
1 parent af75695 commit f364683

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

serial/utils/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TouchSerialPortAt1200bps(port string) error {
3434
// Open port
3535
p, err := serial.Open(port, &serial.Mode{BaudRate: 1200})
3636
if err != nil {
37-
return fmt.Errorf("opening port at 1200bps")
37+
return fmt.Errorf("opening port %s at 1200bps, err: %w", port, err)
3838
}
3939

4040
if runtime.GOOS != "windows" {
@@ -44,7 +44,7 @@ func TouchSerialPortAt1200bps(port string) error {
4444
// Set DTR to false
4545
if err = p.SetDTR(false); err != nil {
4646
p.Close()
47-
return fmt.Errorf("setting DTR to OFF")
47+
return fmt.Errorf("setting DTR to OFF, err: %w", err)
4848
}
4949
}
5050

0 commit comments

Comments
 (0)