modal.result .then(function () { onRouteChangeOff(); return self.onOk(); }) .catch(function (error) { self.logError(error); self.notifyError(error); }) .then(function () { services.State.go(toState, toParams); })It seems to me that this is written incorrectly. Why there is a catch block - should it be just the code without catch? E.g. if the modal returns OK, it should go inside first block?