Giter VIP home page Giter VIP logo

Comments (1)

mmkal avatar mmkal commented on September 10, 2024 1

I believe this is due to the underlying redis client. You can reproduce it by creating a client without using this library at all:

const { createClient } = require("redis");

const redis = createClient({ host: "127.0.0.1", port: 9898 }); // 9898 is just a port redis _isn't_ listening on

redis.ping((err, reply) => {
    console.log({ err, reply });
});

👆 this exits with an unhandled ECONNREFUSED error.

Their docs have some suggestions about what to do to handle connection problems: https://www.npmjs.com/package/redis#connection-and-other-events - I'd suggest trying having a look through them. If you think something's missing it probably makes sense to open an issue there. If it isn't fixed there, feel free to comment here or open another issue requesting a workaround. But I don't think it's necessary - your approach of adding a global error handler seems sensible to me. It shouldn't suppress all errors:

const { createHandyClient } = require("handy-redis");

const client = createHandyClient();

client.redis.on("error", err => {
    console.log("global error: " + err);
});

client
    .set("foo", "bar", ["EX", "NotANumberSoShouldResultInAnError"])
    .then(console.log)
    .catch(err => console.log("scoped error:" + err));

👆 prints scoped error: ReplyError: ERR value is not an integer or out of range

from handy-redis.

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.