INNER CODE UNIT · TypeScript

RmqErrorService

AlariCode/nestjs-rmq · lib/rmq-error.service.ts:10

export class RmqErrorService {
	private options: IRMQServiceOptions;

	constructor(@Inject(RMQ_MODULE_OPTIONS) options: IRMQServiceOptions) {
		this.options = options;
	}

	public buildError(error: Error | RMQError) {
		if (!error) {
			return null;
		}
		let errorHeaders = {};
		errorHeaders['-x-error'] = error.message;
		errorHeaders['-x-host'] = hostname();
		errorHeaders['-x-service'] = this.options.serviceName;
		if (this.isRMQError(error)) {
			errorHeaders = {
				...errorHeaders,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…