The question is:
I'm currently working on Node.js with the Puppeteer library and I need to print "SUCCESS" to the console after a successful run and "ERROR" after a failed run. But I don't quite understand how to do it.
I will be grateful to everyone for help.
CodePudding user response:
console.log('Success'); console.log('error');
https://nodejs.dev/learn/output-to-the-command-line-using-nodejs
CodePudding user response:
You could wrap the whole thing in a try...catch
try {
// Your Code Here
console.log('Success')
} catch (e) {
console.log('Error')
}