4 examples of 'nodejs throw' in JavaScript

Every line of 'nodejs throw' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
53function do_throw(msg) {
54 throw new Error(msg);
55}
147function _throw(msg,e){
148 if(!e){
149 e = {
150 message: msg
151 ,file:'jsxml.js'
152 ,'function': cfg.name
153 };
154 }
155 ERROR.add(e)
156 switch (cfg.errors) {
157 case 'alert':
158 if(msg) alert(cfg.name + ":\r\n" + msg)
159 else ERROR.show(e)
160 break;
161 case 'throw':
162 if(msg) throw new Error(cfg.name + ":\r\n" + msg)
163 else throw e
164 break;
165 case 'ignore':
166 break;
167 }
168}
501process.nextTick(function throwIt() {
502 throw new Error('async exception error');
503});
11function doThrow(error, stack = error.stack || Cs.caller) {
12 let filename = "";
13 if (stack instanceof Ci.nsIStackFrame) {
14 filename = stack.filename;
15 } else if (error.fileName) {
16 filename = error.fileName;
17 }
18
19 throw (new Error(`Error at ${filename}`));
20}

Related snippets