Proper way of creating custom error object

34 views
Skip to first unread message

Denys Khanzhiyev

unread,
Oct 20, 2012, 7:55:45 AM10/20/12
to nod...@googlegroups.com
With following code 

var 
 util = require('util');

function err1(){
    Error.call(this,arguments);   
}

err1.prorotype = Error.prototype;


function err2(){

}

err2.prorotype = Error.prototype;


function err3(){
    Error.call(this,arguments);   
}
util.inherits(err3,Error);


var
   e0 = new Error('zz'),
   e1 = new err1('z1'),
   e2 = new err2('z2'),
   e3 = new err3('z3');

console.log(e0.stack);
console.log(e1.stack);
console.log(e2.stack);
console.log(e3.stack);


Only e0.stack is defined

I want stack in my error object.

Regards,
Denys

Denys Khanzhiyev

unread,
Oct 20, 2012, 8:15:35 AM10/20/12
to nod...@googlegroups.com
Already found  solition here

Reply all
Reply to author
Forward
0 new messages