Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always use Error constructor #3

Closed
niclashoyer opened this issue Jul 3, 2014 · 1 comment
Closed

Always use Error constructor #3

niclashoyer opened this issue Jul 3, 2014 · 1 comment

Comments

@niclashoyer
Copy link

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
Copy link
Owner

diosney commented Jul 3, 2014

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

@diosney diosney closed this as completed in 557204e Jul 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants