@@ -312,8 +312,11 @@ 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 {
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 )
317320 } else if msg .ProtocolVersion > 1 {
318321 return errors .Errorf (tr ("protocol version not supported: requested 1, got %d" ), msg .ProtocolVersion )
319322 }
@@ -333,8 +336,11 @@ func (disc *PluggableDiscovery) Start() error {
333336 return fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "START" , err )
334337 } else if msg .EventType != "start" {
335338 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 )
338344 }
339345 disc .statusMutex .Lock ()
340346 defer disc .statusMutex .Unlock ()
@@ -353,8 +359,11 @@ func (disc *PluggableDiscovery) Stop() error {
353359 return fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "STOP" , err )
354360 } else if msg .EventType != "stop" {
355361 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 )
358367 }
359368 disc .statusMutex .Lock ()
360369 defer disc .statusMutex .Unlock ()
@@ -376,8 +385,11 @@ func (disc *PluggableDiscovery) Quit() error {
376385 return fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "QUIT" , err )
377386 } else if msg .EventType != "quit" {
378387 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 )
381393 }
382394 disc .killProcess ()
383395 return nil
@@ -416,8 +428,11 @@ func (disc *PluggableDiscovery) StartSync(size int) (<-chan *Event, error) {
416428 return nil , fmt .Errorf (tr ("calling %[1]s: %[2]w" ), "START_SYNC" , err )
417429 } else if msg .EventType != "start_sync" {
418430 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 )
421436 }
422437
423438 disc .statusMutex .Lock ()
0 commit comments