Transition retry & try catch


#1

Hello,

I’ve got a problem with transition.retry, sometimes, when the transition has query parameters, transition.retry, throw an error, I was looking, and I found that’s a known error, but I wish to manage when the transition has been crashed with a try catch, my problem is that I’m using the following code:

    var old_transition=pending_transition;
    pending_transition=null;
    try{
      old_transition.retry();
    } catch (e){
      console.log("catch");
      this.transitionToRoute('data', 0);
    }

But this try catch, don’t catch my exception, and is caching on the basic ember tryCatch function that use before it call my code. I don’t know what the fucking I’m doing wrong. I triend to generate some error manually and it was cached for my code without problem.

This is a jsbin that I made to check the error about transition.retry().

Thanks Dracks


#2

I found why the try catch was not caching the exceptions, is because, the retry, don’t throw the exception, It returns a promise, and you can use the promise to cach errors:

		var _this=this;
		var retry=previousTransition.retry();
		retry.catch(function (){
			_this.transitionToRoute('navigation.index');
		});

Thanks!