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

Consider returning undefined instead of a stream #9

Closed
phated opened this issue Sep 14, 2016 · 8 comments
Closed

Consider returning undefined instead of a stream #9

phated opened this issue Sep 14, 2016 · 8 comments

Comments

@phated
Copy link
Contributor

phated commented Sep 14, 2016

I found it very counter-intuitive that this module returns a stream but it doesn't propagate errors to it. Would you consider not returning the produced stream?

@yoshuawuyts
Copy link

+0 on this; I agree with you it's the more intuitive solution, but pump is widely used and API stability counts for something - so perhaps better docs is the best resolution?

@phated
Copy link
Contributor Author

phated commented Sep 14, 2016

@yoshuawuyts if you are using the returned stream from pump, you most likely want to be using pumpify instead of pump, right?

@mafintosh
Copy link
Owner

fyi, it returns the last stream to be api-compatible with .pipe - i agree the docs could be clearer on this.

@phated
Copy link
Contributor Author

phated commented Sep 14, 2016

To elaborate on this a bit more: We were planning to recommend pump for writing gulpfiles, but gulp handles people returning streams by listening for error and end events with end-of-stream; however, this module swallows the errors but still looks/acts like a stream in other ways. It seems like a footgun for people if they use implicit returns from arrow functions and no callback with pump (this happened with a gulpfile in the lodash org).

@phated
Copy link
Contributor Author

phated commented Sep 14, 2016

cc @jdalton

@mafintosh
Copy link
Owner

i don't feel strongly about this. we can do a major bump and not return the last stream if it is a big issue. feel free to pr that.

@phated
Copy link
Contributor Author

phated commented Sep 15, 2016

@mafintosh cool, I'll do it in a few days to leave this open for a bit to get more feedback

@qfox
Copy link

qfox commented Oct 5, 2016

Isn't it be more intuitive to use pump just in pipe calls? Not sure it's understandable as it can be:

pump(
  gulp.src('./*.files'),
  transform1(),
  transform2(),
  gulp.dest('./'),
  (err) => (err && console.error(err))
);

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

4 participants