@bymax-one/nest-queue 1.2.8 → 1.2.9

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
@@ -11,6 +11,27 @@ versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
11
11
 
12
12
  ---
13
13
 
14
+ ## [1.2.9] — 2026-11-01
15
+
16
+ No action required: behaviour for an `Error` with a string `message` is unchanged, and the public API, the types
17
+ (`index.d.ts` and `index.d.cts` are identical) and the peer ranges are unchanged. Measured with
18
+ `diff -r` of a fresh build against the unpacked 1.2.8 tarball, only the two runtime bundles
19
+ (`index.mjs`, `index.cjs`) differ.
20
+
21
+ ### Fixed
22
+
23
+ - **The fallback `error` listener no longer throws on an emission that is not an `Error`.** The
24
+ listener the library attaches to every `Queue`, `Worker` and `QueueEvents`, and to the `FlowProducer` when flows are enabled, read
25
+ `err.message` directly, so `emit('error', undefined)` or `emit('error', null)` threw a `TypeError`
26
+ out of the listener, and out of `emit` to its caller, which can end the process. It now logs
27
+ whatever value arrived, falling back to a fixed phrase for one it cannot print.
28
+ - **A rejected `enqueueBulk` with a non-`Error` reason still produces `BULK_ENQUEUE_FAILED`.**
29
+ The cause was read with `(err as Error).message`, which threw a `TypeError` for a `null` or
30
+ `undefined` rejection, replacing the typed exception; it now carries a string cause for any
31
+ rejected value.
32
+
33
+ ---
34
+
14
35
  ## [1.2.8] — 2026-11-01
15
36
 
16
37
  No action required: behaviour, the public API, the types and the peer ranges are unchanged.
@@ -747,7 +768,8 @@ v6 peer range.
747
768
 
748
769
  ---
749
770
 
750
- [Unreleased]: https://github.com/bymaxone/nest-queue/compare/v1.2.8...HEAD
771
+ [Unreleased]: https://github.com/bymaxone/nest-queue/compare/v1.2.9...HEAD
772
+ [1.2.9]: https://github.com/bymaxone/nest-queue/compare/v1.2.8...v1.2.9
751
773
  [1.2.8]: https://github.com/bymaxone/nest-queue/compare/v1.2.7...v1.2.8
752
774
  [1.2.7]: https://github.com/bymaxone/nest-queue/compare/v1.2.6...v1.2.7
753
775
  [1.2.6]: https://github.com/bymaxone/nest-queue/compare/v1.2.5...v1.2.6
@@ -368,10 +368,22 @@ function validateJobSchedulerOptions(repeat) {
368
368
  }
369
369
  }
370
370
 
371
+ // src/server/utils/describe-error.ts
372
+ function describeError(cause) {
373
+ try {
374
+ if (typeof cause === "object" && cause !== null && "message" in cause) {
375
+ if (typeof cause.message === "string") return cause.message;
376
+ }
377
+ return String(cause);
378
+ } catch {
379
+ return "unknown error";
380
+ }
381
+ }
382
+
371
383
  // src/server/utils/attach-error-listener.ts
372
384
  function attachDefaultErrorListener(emitter, logger, kind, queueName) {
373
385
  emitter.on("error", (err) => {
374
- logger.error(`${kind} for queue "${queueName}" emitted an error: ${err.message}`);
386
+ logger.error(`${kind} for queue "${queueName}" emitted an error: ${describeError(err)}`);
375
387
  });
376
388
  }
377
389
 
@@ -503,7 +515,7 @@ exports.QueueService = class QueueService {
503
515
  QUEUE_ERROR_CODES.BULK_ENQUEUE_FAILED,
504
516
  common.HttpStatus.INTERNAL_SERVER_ERROR,
505
517
  {
506
- cause: err.message
518
+ cause: describeError(err)
507
519
  }
508
520
  );
509
521
  }
@@ -809,20 +821,6 @@ exports.MetricsService = class MetricsService {
809
821
  exports.MetricsService = __decorateClass([
810
822
  common.Injectable()
811
823
  ], exports.MetricsService);
812
-
813
- // src/server/utils/describe-error.ts
814
- function describeError(cause) {
815
- try {
816
- if (typeof cause === "object" && cause !== null && "message" in cause) {
817
- if (typeof cause.message === "string") return cause.message;
818
- }
819
- return String(cause);
820
- } catch {
821
- return "unknown error";
822
- }
823
- }
824
-
825
- // src/server/services/worker-registry.service.ts
826
824
  var _entries;
827
825
  exports.WorkerRegistry = class WorkerRegistry {
828
826
  constructor(connection, options) {
@@ -366,10 +366,22 @@ function validateJobSchedulerOptions(repeat) {
366
366
  }
367
367
  }
368
368
 
369
+ // src/server/utils/describe-error.ts
370
+ function describeError(cause) {
371
+ try {
372
+ if (typeof cause === "object" && cause !== null && "message" in cause) {
373
+ if (typeof cause.message === "string") return cause.message;
374
+ }
375
+ return String(cause);
376
+ } catch {
377
+ return "unknown error";
378
+ }
379
+ }
380
+
369
381
  // src/server/utils/attach-error-listener.ts
370
382
  function attachDefaultErrorListener(emitter, logger, kind, queueName) {
371
383
  emitter.on("error", (err) => {
372
- logger.error(`${kind} for queue "${queueName}" emitted an error: ${err.message}`);
384
+ logger.error(`${kind} for queue "${queueName}" emitted an error: ${describeError(err)}`);
373
385
  });
374
386
  }
375
387
 
@@ -501,7 +513,7 @@ var QueueService = class {
501
513
  QUEUE_ERROR_CODES.BULK_ENQUEUE_FAILED,
502
514
  HttpStatus.INTERNAL_SERVER_ERROR,
503
515
  {
504
- cause: err.message
516
+ cause: describeError(err)
505
517
  }
506
518
  );
507
519
  }
@@ -807,20 +819,6 @@ var MetricsService = class {
807
819
  MetricsService = __decorateClass([
808
820
  Injectable()
809
821
  ], MetricsService);
810
-
811
- // src/server/utils/describe-error.ts
812
- function describeError(cause) {
813
- try {
814
- if (typeof cause === "object" && cause !== null && "message" in cause) {
815
- if (typeof cause.message === "string") return cause.message;
816
- }
817
- return String(cause);
818
- } catch {
819
- return "unknown error";
820
- }
821
- }
822
-
823
- // src/server/services/worker-registry.service.ts
824
822
  var _entries;
825
823
  var WorkerRegistry = class {
826
824
  constructor(connection, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bymax-one/nest-queue",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "NestJS dynamic module wrapping BullMQ — typed jobs, flows, job schedulers, deduplication, OpenTelemetry, graceful shutdown",
5
5
  "author": "Bymax One <support@bymax.one>",
6
6
  "license": "MIT",