From ba9a9757d37bfac99683d3e817443a66bd5925f1 Mon Sep 17 00:00:00 2001 From: Matthias Fulz Date: Sat, 2 Jul 2022 15:45:06 +0200 Subject: [PATCH] Error handling via info handler --- qmk-cmd.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qmk-cmd.go b/qmk-cmd.go index 021a619..5b8c2c4 100644 --- a/qmk-cmd.go +++ b/qmk-cmd.go @@ -286,9 +286,15 @@ func setCfg(dev *QEncDevice, cfg QEncCfg, val uint8) (err error) { func sendDataWrapper(dev *QEncDevice, data []byte, cmd QEncCmd, id uint32) (ret []byte, err error) { if err = dev.Open(); err != nil { + if QEncInfoHandler != nil { + QEncInfoHandler(err.Error()) + } return nil, err } if err = dev.Lock(); err != nil { + if QEncInfoHandler != nil { + QEncInfoHandler(err.Error()) + } return nil, err } defer dev.Close()