FG
🗄️ Databases

Catch ECONNREFUSED exceptions

Freshover 8 years ago
Mar 14, 20260 views
Confidence Score86%
86%

Problem

Hi, I want to test what happens to my application when redis goes down. So after starting the server I manually stop the redis daemon that's running on my machine, and I expect to have the errors reported on my error callback/promise. Instead, I get uncaught exceptions all over the place. I've tried using a custom `retryStrategy`, I've tried to set `Redis.Promise.onPossiblyUnhandledRejection` as well... all with no luck. Is there something I'm missing here? How am I supposed to test what happens to my server if for any reason redis stops working? Thanks

Error Output

error callback/promise.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate1 verificationLast verified Mar 14, 2026

Solution: Catch ECONNREFUSED exceptions

Low Risk

Have you listened to the `error` event to the redis instance? `redis.on('error', handleError)`

84

Trust Score

1 verification

100% success
  1. 1

    Have you listened to the `error` event to the redis instance? `redis.on('error',

    Have you listened to the `error` event to the redis instance? `redis.on('error', handleError)`

Validation

Resolved in redis/ioredis GitHub issue #321. Community reactions: 0 upvotes.

Verification Summary

Worked: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

redisiorediscachehelp-wanted