Code Monkey home page Code Monkey logo

Comments (7)

ForbesLindesay avatar ForbesLindesay commented on May 22, 2024

That's not normally something you'd want to turn on and off?

from debug.

tj avatar tj commented on May 22, 2024

hmm -1 from me, I think errors should always be to stderr

from debug.

ForbesLindesay avatar ForbesLindesay commented on May 22, 2024

I'm inclined to say:

  1. Libraries should never log errors, under any circumstances. They can log other debugging info, but errors should be thrown (or passed to callbacks)
  2. Applications should never hide errors, under any circumstances. If there's an unhandled error in an application, it should always get logged to stderr, and has nothing to do with debugging settings.

from debug.

tj avatar tj commented on May 22, 2024

yeah in libs they should be emitted, but in your application etc you should delegate to something central for logging and output to stderr. Through the integration of whatever library into your application they should always reach there anyway so I dont think adding a bunch of if (err) debug(err) calls would help much

from debug.

SLM-Linus avatar SLM-Linus commented on May 22, 2024

Hmm, I totally agree with @ForbesLindesay's two points. It slipped my mind that debug isn't always enabled, I just wanted a way to print an error and see which part of my app it came from.

I also think that there might be times when you want to print it under debug circumstances thought. I'm working on a small lib to easily build api servers and clients. On the server side you register all your functions which all can take a callback (which will be executed on the client). In the case of an error, you send it in as the first parameter of the callback. The error then gets serialized and sent over an socket to the client.

When debugging this it's very nice to be able to log the Error object before sending it away to the client and forgetting about it.

In this case it would be really nice to have this feature.

from debug.

tj avatar tj commented on May 22, 2024

fair enough it'll be a tiny patch anyway

from debug.

SLM-Linus avatar SLM-Linus commented on May 22, 2024

Super, thanks!

from debug.

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.