redis-smq-common 1.0.0-rc.7 → 1.0.0-rc.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 1.0.0-rc.6 (2022-05-30)
3
+ ## 1.0.0-rc.8 (2022-05-30)
4
+
5
+ * Add WatchedKeysChangedError class (1e42e80)
6
+
7
+ ## 1.0.0-rc.7 (2022-05-30)
4
8
 
5
9
  * Fix various redis errors (9349261)
6
10
 
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IoredisClientMulti = void 0;
4
4
  const redis_client_error_1 = require("../errors/redis-client.error");
5
+ const watched_keys_changed_error_1 = require("../errors/watched-keys-changed.error");
5
6
  class IoredisClientMulti {
6
7
  constructor(client) {
7
8
  this.multi = client.multi();
@@ -71,7 +72,7 @@ class IoredisClientMulti {
71
72
  if (err)
72
73
  cb(err);
73
74
  else if (!reply)
74
- cb(new redis_client_error_1.RedisClientError(`Redis transaction has been abandoned. Try again.`));
75
+ cb(new watched_keys_changed_error_1.WatchedKeysChangedError());
75
76
  else {
76
77
  const lengths = [];
77
78
  let err = null;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NodeRedisV3ClientMulti = void 0;
4
- const redis_client_error_1 = require("../errors/redis-client.error");
4
+ const watched_keys_changed_error_1 = require("../errors/watched-keys-changed.error");
5
5
  class NodeRedisV3ClientMulti {
6
6
  constructor(client) {
7
7
  this.multi = client.multi();
@@ -71,7 +71,7 @@ class NodeRedisV3ClientMulti {
71
71
  if (err)
72
72
  cb(err);
73
73
  else if (!reply)
74
- cb(new redis_client_error_1.RedisClientError(`Redis transaction has been abandoned. Try again.`));
74
+ cb(new watched_keys_changed_error_1.WatchedKeysChangedError());
75
75
  else
76
76
  cb(null, reply);
77
77
  });
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NodeRedisV4ClientMulti = void 0;
4
+ const client_1 = require("@redis/client");
5
+ const watched_keys_changed_error_1 = require("../errors/watched-keys-changed.error");
4
6
  class NodeRedisV4ClientMulti {
5
7
  constructor(client) {
6
8
  this.multi = client.multi();
@@ -69,7 +71,12 @@ class NodeRedisV4ClientMulti {
69
71
  this.multi
70
72
  .exec()
71
73
  .then((reply) => cb(null, reply))
72
- .catch(cb);
74
+ .catch((err) => {
75
+ if (err instanceof client_1.WatchError)
76
+ cb(new watched_keys_changed_error_1.WatchedKeysChangedError());
77
+ else
78
+ cb(err);
79
+ });
73
80
  }
74
81
  }
75
82
  exports.NodeRedisV4ClientMulti = NodeRedisV4ClientMulti;
@@ -0,0 +1,4 @@
1
+ import { RedisClientError } from './redis-client.error';
2
+ export declare class WatchedKeysChangedError extends RedisClientError {
3
+ constructor(msg?: string);
4
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WatchedKeysChangedError = void 0;
4
+ const redis_client_error_1 = require("./redis-client.error");
5
+ class WatchedKeysChangedError extends redis_client_error_1.RedisClientError {
6
+ constructor(msg = 'One (or more) of the watched keys has been changed') {
7
+ super(msg);
8
+ }
9
+ }
10
+ exports.WatchedKeysChangedError = WatchedKeysChangedError;
11
+ //# sourceMappingURL=watched-keys-changed.error.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redis-smq-common",
3
- "version": "1.0.0-rc.7",
3
+ "version": "1.0.0-rc.8",
4
4
  "description": "RedisSMQ shared components that may be used by integrated applications and extensions.",
5
5
  "author": "Weyoss <weyoss@protonmail.com>",
6
6
  "license": "MIT",