@@ -312,8 +312,10 @@ func (disc *PluggableDiscovery) Run() (err error) {
312312 return fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "HELLO" , err )
313313 } else if msg .EventType != "hello" {
314314 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 {
316316 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 )
317319 } else if msg .ProtocolVersion > 1 {
318320 return errors .Errorf (tr ("protocol version not supported: requested 1, got %d" ), msg .ProtocolVersion )
319321 }
@@ -333,8 +335,10 @@ func (disc *PluggableDiscovery) Start() error {
333335 return fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "START" , err )
334336 } else if msg .EventType != "start" {
335337 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 {
337339 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 )
338342 }
339343 disc .statusMutex .Lock ()
340344 defer disc .statusMutex .Unlock ()
@@ -353,8 +357,10 @@ func (disc *PluggableDiscovery) Stop() error {
353357 return fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "STOP" , err )
354358 } else if msg .EventType != "stop" {
355359 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 {
357361 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 )
358364 }
359365 disc .statusMutex .Lock ()
360366 defer disc .statusMutex .Unlock ()
@@ -376,8 +382,10 @@ func (disc *PluggableDiscovery) Quit() error {
376382 return fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "QUIT" , err )
377383 } else if msg .EventType != "quit" {
378384 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 {
380386 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 )
381389 }
382390 disc .killProcess ()
383391 return nil
@@ -416,8 +424,10 @@ func (disc *PluggableDiscovery) StartSync(size int) (<-chan *Event, error) {
416424 return nil , fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "START_SYNC" , err )
417425 } else if msg .EventType != "start_sync" {
418426 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 {
420428 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 )
421431 }
422432
423433 disc .statusMutex .Lock ()
0 commit comments