0

I want to trigger an error so I can see if my code works.

My countdown function contains a promise with a response if resolved and another if rejected (promise got an error). I want to trigger an error on catch to see the console message as prescribed. So for the first time in 24 years I want to hit the SysRq key or break key on my keyboard to trigger the catch error message. BUT modern keyboards no longer have SysRq key or a Break key (common back in the MS-DOS era). How can I trigger the catch error? Thanks in advance. ```` function countdown(seconds) { return new Promise(function(resolve, reject) { for(let i=seconds; i>=0; i--) { setTimeout(function(){ if(i>0) console.log(i + '...'); else resolve(console.log("GO!")); }, (seconds-i)*1000); } }); } // the err does not show on screen in repl.it login realproto countdown(11).then( function() { console.log("countdown completed sucessfully"); }, function(err) { console.log("countdown experienced an error: " + err.message); } ); countdown(); ````

2nd Sep 2019, 8:20 PM
Elvis Delahoz
Elvis Delahoz - avatar
1 Réponse
8th Sep 2020, 5:31 PM
Erich Buelow
Erich Buelow - avatar