Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Always use Error constructor #3

Closed
niclashoyer opened this Issue · 1 comment

2 participants

@niclashoyer

While testing the modules I noticed that at some points the errors are not constructed properly. Just passing an object as error is bad, because there is no information on the location (line) and no stack trace. If node the prints the error to the console, the object is converted to string which results in

[object Object]

The change is probably needed in a lot of files, e.g.
add.js line 52:

cb({
    msg : stderror.split('\n')[0],
    cmd : cmd.concat(args).join(' '),
    code: error.code
});

should be

var err = new Error(stderror.split('\n')[0]);
err.cmd = cmd.concat(args).join(' ');
err.code = error.code;
cb(err);
@diosney
Owner

Yeh, you're right, I will change that anytime soon, thanks :)

@diosney diosney closed this issue from a commit
@diosney Fixes #3. 557204e
@diosney diosney closed this in 557204e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.