1.0.5 • Published 2 years ago

taticbr-error-tracking v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

This project contains the code for tracking errors generated in orders.

Installation

npm install taticbr-error-tracking

or

yarn add taticbr-error-tracking

How to use

Implementing on your application

It is necessary to implement a concrete class for the EventEmitterPort abstract class, responsible for sending the error message:

export abstract class EventEmitterPort {
  request: (topic: string, payload: unknown) => Promise<void>;
}

Order error tracking

To implement, you must import the OrderErrorTracking decorator and configure the method to start tracking order errors:

import { Injectable } from '@nestjs/common';
import { OrderErrorTracking } from 'taticbr-error-tracking';

@Injectable()
export class MyService {
  constructor() {}

  @OrderErrorTracking({
    state: "ERROR",
    dataExtractor: (data: any) => data,
  })
  private async execute() {
    // Implementation
  }
}

Configuration

You can configure this lib by setting some environemnt variables:

Environment VariablesUtilityDefault
ORDER_ERROR_TRACKING_TOPICDefines the name of the topic that will be sent to the event emitterOrderErrorTrackingTopic
1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago