Coder Social home page Coder Social logo

Comments (4)

jamestalmage avatar jamestalmage commented on September 24, 2024

Might it be better to do:

Contents Of Original Error Message:
stdout:
  head 1
  head 2
  ...
  tail -2
  tail -1

sterr:
  head 1
  head 2
  ...
  tail -2
  tail -1

And have an error.originalMessage property.

from execa.

sindresorhus avatar sindresorhus commented on September 24, 2024

It's to get good error messages when exit code is non-zero. I sometimes got empty errors when the relevant error was printed on stdout. I like your suggestion. Let's go with it.

Is this providing any real value? If people want to log it to the console, can't they just:

Sure, but when using async functions you first have to try/catch it and then console.log the properties. That's very interrupting for your flow.

With most errors the stdout/stderr output is minimal.

from execa.

kevva avatar kevva commented on September 24, 2024

Mostly, when spawning native binaries (like I do in imagemin) you'll get the real errors on stderr (or in bad cases stdout) and err.message just contains spawn ERRCODE and gives you no valuable info. I have to do like this to circumvent it https://github.com/imagemin/imagemin-gifsicle/blob/067cea4948a6709ad9f39813ed912222e9d5966e/index.js#L32-L33.

from execa.

sindresorhus avatar sindresorhus commented on September 24, 2024

Closing as it's better to be verbose on failure.

from execa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.