Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is it correct code?
Message
 
 
À
Tous
Information générale
Forum:
Javascript
Catégorie:
Codage, syntaxe et commandes
Titre:
Is it correct code?
Divers
Thread ID:
01657875
Message ID:
01657875
Vues:
43
Hi everybody,

We have a directive with the following code
 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?

Can you please translate the intention of this code to me? I see that if I answer 'Cancel' on the modal dialog, I'm inside the catch block with error undefined.

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Répondre
Fil
Voir

Click here to load this message in the networking platform