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

Fix: Ensure piped in code will trigger correct errors (fixes #2154) #2162

Merged
merged 1 commit into from
Mar 28, 2015

Conversation

nzakas
Copy link
Member

@nzakas nzakas commented Mar 27, 2015

This is a bit gross. bin/eslint.js is the one file we don't have unit tests for, but I verified this is working.

The error was being swallowed because the method was being called in a callback.

} catch (ex) {
console.error(ex.message);
exitCode = 1;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn’t this error also end up in the error event of the stream? Anyway it is always a good idea to add an error handler to every error event (https://github.com/maxogden/concat-stream#error-handling).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the error is thrown in the callback, not in the process of reading the stream.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, but somewhere the error gets caught.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I just have no idea where and not enough patience to keep digging in. :)

@lo1tuma
Copy link
Member

lo1tuma commented Mar 28, 2015

Maybe we should try to extract this functionality to a different file where we can write tests more easily or we should write tests for bin/eslint.js.

@nzakas
Copy link
Member Author

nzakas commented Mar 28, 2015

If you want to take a stab at writing tests, I'm all for it. I just don't have the time to figure out the best way to do it (this is part of why we have cli and CLIEngine - I extracted as much as I could into those to get as much test coverage as possible).

nzakas added a commit that referenced this pull request Mar 28, 2015
Fix: Ensure piped in code will trigger correct errors (fixes #2154)
@nzakas nzakas merged commit 04ae6b2 into master Mar 28, 2015
@nzakas nzakas deleted the issue2154 branch March 28, 2015 15:47
@lo1tuma
Copy link
Member

lo1tuma commented Mar 28, 2015

Alright, I will investigate how we could test this.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants