node.js - How to show only the formatted error in a npm script? -
i creating several npm scripts, , saw in case 1 fails, error object returned. show in console, formatted property of object. possible?
currently see in console:
{ "status": 1, "file": "stylesheets/main.scss", "line": 6, "column": 3, "message": "property \"adfasdagdajhgdaj\" must followed ':'", "formatted": "error: property \"adfasdagdajhgdaj\" must followed ':'\n on line 6 of assets/stylesheets/main.scss\n>> adfasdagdajhgdaj\n --^\n" } i have only:
"error: property \"adfasdagdajhgdaj\" must followed ':'\n on line 6 of assets/stylesheets/main.scss\n>> adfasdagdajhgdaj\n --^\n" thanks
you should use try catch block , log formatted
try { //do cool stuff }catch (e) { console.log(e.formatted); }
Comments
Post a Comment