diff --git a/src/consumer/errors/getCauseError.ts b/src/consumer/errors/getErrorCause.ts similarity index 93% rename from src/consumer/errors/getCauseError.ts rename to src/consumer/errors/getErrorCause.ts index d4754de..7fa27df 100644 --- a/src/consumer/errors/getCauseError.ts +++ b/src/consumer/errors/getErrorCause.ts @@ -16,6 +16,6 @@ import { KafkaConsumerError } from "./kafkaConsumerError"; -export function getCauseError(error: unknown): Error { +export function getErrorCause(error: unknown): Error { return (error instanceof KafkaConsumerError ? error.cause : error) as Error; } diff --git a/src/consumer/errors/index.ts b/src/consumer/errors/index.ts index 5212533..612be04 100644 --- a/src/consumer/errors/index.ts +++ b/src/consumer/errors/index.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -export * from "./getCauseError"; +export * from "./getErrorCause"; export * from "./kafkaConsumerError"; export * from "./kafkaConsumerNonRetriableError"; export * from "./kafkaConsumerRetriableError"; diff --git a/src/consumer/exceptions/kafkaConsumerErrorTopicExceptionFilter.ts b/src/consumer/exceptions/kafkaConsumerErrorTopicExceptionFilter.ts index 07611d5..388906c 100644 --- a/src/consumer/exceptions/kafkaConsumerErrorTopicExceptionFilter.ts +++ b/src/consumer/exceptions/kafkaConsumerErrorTopicExceptionFilter.ts @@ -23,7 +23,7 @@ import { import { from, Observable, throwError } from "rxjs"; import { - getCauseError, + getErrorCause, KafkaConsumerError, KafkaConsumerNonRetriableError, KafkaConsumerRetriableError, @@ -102,7 +102,7 @@ export class KafkaConsumerErrorTopicExceptionFilter const payload: IKafkaConsumerPayload = rpcHost.getData(); const context: IKafkaConsumerContext = rpcHost.getContext(); - const cause = getCauseError(kafkaConsumerError); + const cause = getErrorCause(kafkaConsumerError); this.__logger.warn("Send message to error topic"); diff --git a/src/consumer/kafkaConsumerMessageHandler.ts b/src/consumer/kafkaConsumerMessageHandler.ts index d84e959..1702df3 100644 --- a/src/consumer/kafkaConsumerMessageHandler.ts +++ b/src/consumer/kafkaConsumerMessageHandler.ts @@ -29,7 +29,7 @@ import { IKafkaOptions } from "~/src/options"; import { KafkaCoreProducer } from "~/src/producer"; import { KafkaCoreSchemaRegistry } from "~/src/schemaRegistry"; -import { getCauseError, KafkaConsumerError } from "./errors"; +import { getErrorCause, KafkaConsumerError } from "./errors"; import { IKafkaConsumerContext, IKafkaConsumerPayload } from "./interfaces"; import { KafkaConsumerMessageHandlerLogger } from "./kafkaConsumerMessageHandlerLogger"; @@ -90,7 +90,7 @@ export class KafkaConsumerMessageHandler { } operation.stop(); - reject(getCauseError(error)); + reject(getErrorCause(error)); }); }); }); diff --git a/src/consumer/kafkaConsumerMessageHandlerLogger.ts b/src/consumer/kafkaConsumerMessageHandlerLogger.ts index 04cc59e..f7361a2 100644 --- a/src/consumer/kafkaConsumerMessageHandlerLogger.ts +++ b/src/consumer/kafkaConsumerMessageHandlerLogger.ts @@ -18,7 +18,7 @@ import { Tags, TracingService } from "@byndyusoft/nest-opentracing"; import { Injectable, LoggerService } from "@nestjs/common"; import { PinoLogger } from "nestjs-pino"; -import { getCauseError, serializeError } from "./errors"; +import { getErrorCause, serializeError } from "./errors"; @Injectable() export class KafkaConsumerMessageHandlerLogger { @@ -27,7 +27,7 @@ export class KafkaConsumerMessageHandlerLogger { public error(logger: LoggerService | PinoLogger, error: unknown): void { const rootSpan = this.__tracingService.getRootSpan(); - const cause = getCauseError(error); + const cause = getErrorCause(error); logger.error(cause);