angular - angular2 Observable.throw doesn't work after Observable.timer -


i'm trying retrywhen on http.get x-times when communication fails.

after x-times throw error failed connect.

if in delaywhen observable.throw directly works fine , returns on first try. if first times return obersvable.timer, delay next tries connection afterwards observable.throw called not forwarded upper level catch!?

public initializecommunication(): promise<boolean> {  return new promise<boolean>((resolve: (r: boolean) => void, reject: (e:    error) => void) => {  return this.getinternal<dto>(this.url, null,   'clientidentity') .retrywhen((errors: observable<any>) => {                     // retry upon communication failure                     // todo: consider retrying limited number of                      //times , throw error (call reject)                      return errors.delaywhen((response: response) => {                         retrytrys++;                         console.log('number of retries   ' + retrytrys);                          if (retrytrys > 2) {                             console.log('throw');                             return observable.throw(new error('error!'));                         }                         console.log('ret');                         return observable.timer(this.retry_timeout);                     });                 })                 .subscribe() }); } 

and function i'm calling service , in catch not called.

            myservice.initializecommunication().then((r: boolean) => {              })             .catch((error) => { //this not called } 


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -