@@ -218,6 +218,9 @@ func (d *Device) Sync(timeout int) (map[string]any, error) {
218218 }
219219
220220 if res , ok := resp .(* protocol.SyncResponse ); ok {
221+ if res .Error != "" {
222+ return nil , errors .New (res .Error )
223+ }
221224 return res .Values , nil
222225 } else {
223226 return nil , errors .New ("want type SyncResponse" )
@@ -250,6 +253,9 @@ func (d *Device) Read(points []string, timeout int) (map[string]any, error) {
250253 }
251254
252255 if res , ok := resp .(* protocol.ReadResponse ); ok {
256+ if res .Error != "" {
257+ return nil , errors .New (res .Error )
258+ }
253259 return res .Values , nil
254260 } else {
255261 return nil , errors .New ("want type ReadResponse" )
@@ -282,6 +288,9 @@ func (d *Device) Write(values map[string]any, timeout int) (map[string]bool, err
282288 }
283289
284290 if res , ok := resp .(* protocol.WriteResponse ); ok {
291+ if res .Error != "" {
292+ return nil , errors .New (res .Error )
293+ }
285294 return res .Result , nil
286295 } else {
287296 return nil , errors .New ("want type WriteResponse" )
@@ -315,6 +324,9 @@ func (d *Device) Action(action string, parameters map[string]any, timeout int) (
315324 }
316325
317326 if res , ok := resp .(* protocol.ActionResponse ); ok {
327+ if res .Error != "" {
328+ return nil , errors .New (res .Error )
329+ }
318330 return res .Result , nil
319331 } else {
320332 return nil , errors .New ("want type ActionResponse" )
0 commit comments