Error handling via info handler
This commit is contained in:
parent
3556fedfdd
commit
ba9a9757d3
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue