Skip to content

Commit

Permalink
fix: rename getCauseError to getErrorCause
Browse files Browse the repository at this point in the history
  • Loading branch information
Fun795 authored and KillWolfVlad committed Sep 24, 2022
1 parent 6219cd2 commit 25f7e89
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion src/consumer/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

export * from "./getCauseError";
export * from "./getErrorCause";
export * from "./kafkaConsumerError";
export * from "./kafkaConsumerNonRetriableError";
export * from "./kafkaConsumerRetriableError";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
import { from, Observable, throwError } from "rxjs";

import {
getCauseError,
getErrorCause,
KafkaConsumerError,
KafkaConsumerNonRetriableError,
KafkaConsumerRetriableError,
Expand Down Expand Up @@ -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");

Expand Down
4 changes: 2 additions & 2 deletions src/consumer/kafkaConsumerMessageHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -90,7 +90,7 @@ export class KafkaConsumerMessageHandler {
}

operation.stop();
reject(getCauseError(error));
reject(getErrorCause(error));
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/consumer/kafkaConsumerMessageHandlerLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);

Expand Down

0 comments on commit 25f7e89

Please sign in to comment.