@@ -312,8 +312,11 @@ func (disc *PluggableDiscovery) Run() (err error) {
312
312
return fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "HELLO" , err )
313
313
} else if msg .EventType != "hello" {
314
314
return errors .Errorf (tr ("communication out of sync, expected '%[1]s', received '%[2]s'" ), "hello" , msg .EventType )
315
- } else if strings .ToUpper (msg .Message ) != "OK" || msg .Error {
316
- return errors .Errorf (tr ("command failed: %s" ), msg .Message )
315
+ } else if strings .ToUpper (msg .Message ) != "OK" {
316
+ if msg .Error {
317
+ return errors .Errorf (tr ("command failed: %s" ), msg .Message )
318
+ }
319
+ return errors .Errorf (tr ("communication out of sync, expected '%[1]s', received '%[2]s'" ), "OK" , msg .Message )
317
320
} else if msg .ProtocolVersion > 1 {
318
321
return errors .Errorf (tr ("protocol version not supported: requested 1, got %d" ), msg .ProtocolVersion )
319
322
}
@@ -333,8 +336,11 @@ func (disc *PluggableDiscovery) Start() error {
333
336
return fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "START" , err )
334
337
} else if msg .EventType != "start" {
335
338
return errors .Errorf (tr ("communication out of sync, expected '%[1]s', received '%[2]s'" ), "start" , msg .EventType )
336
- } else if strings .ToUpper (msg .Message ) != "OK" || msg .Error {
337
- return errors .Errorf (tr ("command failed: %s" ), msg .Message )
339
+ } else if strings .ToUpper (msg .Message ) != "OK" {
340
+ if msg .Error {
341
+ return errors .Errorf (tr ("command failed: %s" ), msg .Message )
342
+ }
343
+ return errors .Errorf (tr ("communication out of sync, expected '%[1]s', received '%[2]s'" ), "OK" , msg .Message )
338
344
}
339
345
disc .statusMutex .Lock ()
340
346
defer disc .statusMutex .Unlock ()
@@ -353,8 +359,11 @@ func (disc *PluggableDiscovery) Stop() error {
353
359
return fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "STOP" , err )
354
360
} else if msg .EventType != "stop" {
355
361
return errors .Errorf (tr ("communication out of sync, expected '%[1]s', received '%[2]s'" ), "stop" , msg .EventType )
356
- } else if strings .ToUpper (msg .Message ) != "OK" || msg .Error {
357
- return errors .Errorf (tr ("command failed: %s" ), msg .Message )
362
+ } else if strings .ToUpper (msg .Message ) != "OK" {
363
+ if msg .Error {
364
+ return errors .Errorf (tr ("command failed: %s" ), msg .Message )
365
+ }
366
+ return errors .Errorf (tr ("communication out of sync, expected '%[1]s', received '%[2]s'" ), "OK" , msg .Message )
358
367
}
359
368
disc .statusMutex .Lock ()
360
369
defer disc .statusMutex .Unlock ()
@@ -376,8 +385,11 @@ func (disc *PluggableDiscovery) Quit() error {
376
385
return fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "QUIT" , err )
377
386
} else if msg .EventType != "quit" {
378
387
return errors .Errorf (tr ("communication out of sync, expected '%[1]s', received '%[2]s'" ), "quit" , msg .EventType )
379
- } else if strings .ToUpper (msg .Message ) != "OK" || msg .Error {
380
- return errors .Errorf (tr ("command failed: %s" ), msg .Message )
388
+ } else if strings .ToUpper (msg .Message ) != "OK" {
389
+ if msg .Error {
390
+ return errors .Errorf (tr ("command failed: %s" ), msg .Message )
391
+ }
392
+ return errors .Errorf (tr ("communication out of sync, expected '%[1]s', received '%[2]s'" ), "OK" , msg .Message )
381
393
}
382
394
disc .killProcess ()
383
395
return nil
@@ -416,8 +428,11 @@ func (disc *PluggableDiscovery) StartSync(size int) (<-chan *Event, error) {
416
428
return nil , fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "START_SYNC" , err )
417
429
} else if msg .EventType != "start_sync" {
418
430
return nil , errors .Errorf (tr ("communication out of sync, expected '%[1]s', received '%[2]s'" ), "start_sync" , msg .EventType )
419
- } else if strings .ToUpper (msg .Message ) != "OK" || msg .Error {
420
- return nil , errors .Errorf (tr ("command failed: %s" ), msg .Message )
431
+ } else if strings .ToUpper (msg .Message ) != "OK" {
432
+ if msg .Error {
433
+ return nil , errors .Errorf (tr ("command failed: %s" ), msg .Message )
434
+ }
435
+ return nil , errors .Errorf (tr ("communication out of sync, expected '%[1]s', received '%[2]s'" ), "OK" , msg .Message )
421
436
}
422
437
423
438
disc .statusMutex .Lock ()
0 commit comments