This should be 100% backwards-compatible. This allows the caller to now specify cause as an options object such that you can still pass in an Error cause object as well as the constructor so that stack traces are nice. I.e.,
function MyError(cause) {
VError.call({
cause: cause,
constructorOpt: MyError
});
}
util.inherits(MyError, VError);
new MyError(new Error('blah blah'));
This should be 100% backwards-compatible. This allows the caller to now specify cause as an options object such that you can still pass in an Error cause object as well as the constructor so that stack traces are nice. I.e.,