gucong3000 / exec-extra

MIT License
5 stars 0 forks source link

feature request catch #9

Closed zwhitchcox closed 6 years ago

zwhitchcox commented 7 years ago

So, Node has deprecated promises without a catch statement. The error message is kind of annoying, and it'd be nice to have all my code the same way. Can we, instead of the [stdout, stderr] implementation instead just use the catch syntax? It would be much nicer for me, and then I don't have to do .catch(console.error) for no reason.

Anyway, thanks for creating this!

zwhitchcox commented 7 years ago

So, here's some actual code from my project. As you can see, I'm having to check for the stderr and still catch errors, when I'd rather just do that in one place.

  7   it('should import all functions when line is specified', () =>
  8     exec('js-import', ['react']).then(([stdout, stderr]) => {
  9       if (stderr) console.error(stderr)
 10     })
 11     .catch(console.error)
 12   )