@opra/kafka 1.0.5 → 1.0.6

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.
@@ -326,23 +326,25 @@ class KafkaAdapter extends core_1.PlatformAdapter {
326
326
  }
327
327
  };
328
328
  }
329
- _emitError(e, context) {
329
+ _emitError(error, context) {
330
330
  Promise.resolve()
331
331
  .then(async () => {
332
332
  const logger = this.logger;
333
333
  if (context) {
334
+ if (!context.errors.length)
335
+ context.errors.push(error);
334
336
  context.errors = this._wrapExceptions(context.errors);
335
337
  if (context.listenerCount('error')) {
336
338
  await this.emitAsync('error', context.errors[0], context);
337
339
  }
338
340
  if (logger?.error) {
339
- context.errors.forEach(err => logger.error(err, context));
341
+ context.errors.forEach(err => logger.error(err));
340
342
  }
341
343
  return;
342
344
  }
343
- this.logger?.error(e);
345
+ this.logger?.error(error);
344
346
  if (this.listenerCount('error'))
345
- this.emit('error', e);
347
+ this.emit('error', error);
346
348
  })
347
349
  .catch(noOp);
348
350
  }
@@ -323,23 +323,25 @@ export class KafkaAdapter extends PlatformAdapter {
323
323
  }
324
324
  };
325
325
  }
326
- _emitError(e, context) {
326
+ _emitError(error, context) {
327
327
  Promise.resolve()
328
328
  .then(async () => {
329
329
  const logger = this.logger;
330
330
  if (context) {
331
+ if (!context.errors.length)
332
+ context.errors.push(error);
331
333
  context.errors = this._wrapExceptions(context.errors);
332
334
  if (context.listenerCount('error')) {
333
335
  await this.emitAsync('error', context.errors[0], context);
334
336
  }
335
337
  if (logger?.error) {
336
- context.errors.forEach(err => logger.error(err, context));
338
+ context.errors.forEach(err => logger.error(err));
337
339
  }
338
340
  return;
339
341
  }
340
- this.logger?.error(e);
342
+ this.logger?.error(error);
341
343
  if (this.listenerCount('error'))
342
- this.emit('error', e);
344
+ this.emit('error', error);
343
345
  })
344
346
  .catch(noOp);
345
347
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@opra/kafka",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Opra Kafka package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
- "@opra/common": "^1.0.5",
9
- "@opra/core": "^1.0.5",
8
+ "@opra/common": "^1.0.6",
9
+ "@opra/core": "^1.0.6",
10
10
  "node-events-async": "^1.0.0",
11
11
  "tslib": "^2.8.0",
12
12
  "valgen": "^5.10.0"
@@ -112,7 +112,7 @@ export declare class KafkaAdapter extends PlatformAdapter {
112
112
  * @protected
113
113
  */
114
114
  protected _createHandler(args: HandlerArguments): void;
115
- protected _emitError(e: any, context?: KafkaContext): void;
115
+ protected _emitError(error: any, context?: KafkaContext): void;
116
116
  protected _wrapExceptions(exceptions: any[]): OpraException[];
117
117
  protected _createLogCreator(logger: ILogger, logExtra?: boolean): ({ namespace, level, log }: {
118
118
  namespace: any;