Giter Site home page Giter Site logo

exception handling about node-statsd HOT 3 CLOSED

Dieterbe avatar Dieterbe commented on June 29, 2024
exception handling

from node-statsd.

Comments (3)

Dieterbe avatar Dieterbe commented on June 29, 2024

for now, i found sort of a way to do it:
in your main app, you can leverage the fact that you have access to c.socket and just do:

c.socket.on('error', function (exception) {
   #return console.log ("error event in socket.send(): " + exception);
   return;
});

only problem is, node prints stacktraces and I can't find how to disable it. # edit, this seems to have magically fixed itself.
related pull request #18

from node-statsd.

devdazed avatar devdazed commented on June 29, 2024

it may be useful to make the client itself an event emitter, this way the user doesn't need to have the knowledge of "socket" and we can emit our own events/errors if need be.

from node-statsd.

devdazed avatar devdazed commented on June 29, 2024

the new version adds the ability to provide a callback to each method. the callback returns an error if the message was not sent and returns the number of bytes sent if it was. This has been documented in the readme. Any other socket exceptions are bubbled up and the user can add a listener to it if they please.

from node-statsd.

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.