Error handling via info handler

This commit is contained in:
Matthias Fulz 2022-07-02 15:45:06 +02:00
parent 3556fedfdd
commit ba9a9757d3
1 changed files with 6 additions and 0 deletions

View File

@ -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) { func sendDataWrapper(dev *QEncDevice, data []byte, cmd QEncCmd, id uint32) (ret []byte, err error) {
if err = dev.Open(); err != nil { if err = dev.Open(); err != nil {
if QEncInfoHandler != nil {
QEncInfoHandler(err.Error())
}
return nil, err return nil, err
} }
if err = dev.Lock(); err != nil { if err = dev.Lock(); err != nil {
if QEncInfoHandler != nil {
QEncInfoHandler(err.Error())
}
return nil, err return nil, err
} }
defer dev.Close() defer dev.Close()