2017-09-14 2 views
-1

Comment pouvons-nous intercepter des exceptions non gérées au niveau de l'application? Je veux enregistrer les exceptions non gérées dans un fichier journal.Gestion des exceptions dans le rapporteur

+0

Voulez-vous pour attraper les exceptions au niveau de l'application ou le niveau du rapporteur? –

Répondre

0

Vous pouvez ajouter deuxième rappel à .then():

Via Protractor FAQ:

elm.click().then(function() { /* passing case */}, function(err) { /* error handling here */}) 

Ou, si vous utilisez async/await, vous pouvez le manipuler dans le bloc régulier try/catch:

try { 
    await elm.click(); 
    /* passing case */ 
} catch (err) { 
    /* error handling here */ 
}