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