@@ -28,7 +28,7 @@ import { filter, takeUntil, first } from 'rxjs/operators';
2828import Daemon from './daemon' ;
2929
3030// Required agent version
31- const MIN_VERSION = '1.1.71 ' ;
31+ const MIN_VERSION = '1.1.72 ' ;
3232const browser = detect ( ) ;
3333const POLLING_INTERVAL = 2500 ;
3434const UPLOAD_DONE_TIMER = 5000 ;
@@ -157,10 +157,7 @@ export default class SocketDaemon extends Daemon {
157157 if ( updateAttempts < 4 ) {
158158 return timer ( 10000 ) . subscribe ( ( ) => this . update ( ) ) ;
159159 }
160- const currentError = this . error . getValue ( ) ;
161- if ( currentError !== 'plugin version incompatible' ) {
162- this . error . next ( 'plugin version incompatible' ) ;
163- }
160+ this . error . next ( 'plugin version incompatible' ) ;
164161 return Promise . reject ( new Error ( 'plugin version incompatible' ) ) ;
165162 }
166163
@@ -251,15 +248,19 @@ export default class SocketDaemon extends Daemon {
251248 headers : {
252249 'Content-Type' : 'text/plain; charset=utf-8'
253250 }
254- } ) . then ( ( ) => Promise . reject ( ) ) // We reject the promise because the daemon will be restarted, we need to continue looking for the port
255- . catch ( err => {
256- if ( err && err . data && err . data . error && ( err . data . error . indexOf ( 'proxy' ) !== - 1 || err . data . error . indexOf ( 'dial tcp' ) !== - 1 ) ) {
257- const currentError = this . error . getValue ( ) ;
258- if ( currentError !== 'proxy error' ) {
251+ } )
252+ . then ( result => result . json ( ) )
253+ . then ( response => {
254+ if ( ! response . ok ) {
255+ if ( response && response . error && ( response . error . indexOf ( 'proxy' ) !== - 1 || response . error . indexOf ( 'dial tcp' ) !== - 1 ) ) {
259256 this . error . next ( 'proxy error' ) ;
257+ return new Error ( 'proxy error' ) ;
260258 }
261259 }
262- } ) ;
260+ // We reject the promise because the daemon will be restarted, we need to continue looking for the port
261+ return Promise . reject ( ) ;
262+ } )
263+ . catch ( err => Promise . reject ( err ) ) ;
263264 }
264265
265266 /**
0 commit comments