Skip to content

Commit

Permalink
chore: exception.ToString() replaced by nameof(exception) in logging …
Browse files Browse the repository at this point in the history
…statements
  • Loading branch information
NikolaVetnic committed Oct 18, 2023
1 parent e0f59f5 commit 4af572c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public override void OnException(ExceptionContext context)
switch (context.Exception)
{
case InfrastructureException infrastructureException:
_logger.InvalidUserInput(infrastructureException.ToString(), infrastructureException.Code, infrastructureException.Message);
_logger.InvalidUserInput(nameof(infrastructureException), infrastructureException.Code, infrastructureException.Message);

httpError = CreateHttpErrorForInfrastructureException(infrastructureException);

Expand All @@ -51,7 +51,7 @@ public override void OnException(ExceptionContext context)

break;
case ApplicationException applicationException:
_logger.InvalidUserInput(applicationException.ToString(), applicationException.Code, applicationException.Message);
_logger.InvalidUserInput(nameof(applicationException), applicationException.Code, applicationException.Message);

httpError = CreateHttpErrorForApplicationException(applicationException);

Expand All @@ -61,7 +61,7 @@ public override void OnException(ExceptionContext context)
break;

case DomainException domainException:
_logger.InvalidUserInput(domainException.ToString(), domainException.Code, domainException.Message);
_logger.InvalidUserInput(nameof(domainException), domainException.Code, domainException.Message);

httpError = CreateHttpErrorForDomainException(domainException);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public bool TryConnect()
.Or<BrokerUnreachableException>()
.WaitAndRetry(_retryCount,
retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)),
(ex, _) => _logger.BrokerUnreachableException(ex.ToString()));
(ex, _) => _logger.BrokerUnreachableException(nameof(ex)));

policy.Execute(() => _connection = _connectionFactory
.CreateConnection());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void Publish(IntegrationEvent @event)
.Or<SocketException>()
.WaitAndRetry(_connectionRetryCount,
retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)),
(ex, _) => _logger.SocketException(ex.ToString()));
(ex, _) => _logger.SocketException(nameof(ex)));

var eventName = @event.GetType().Name;

Expand Down

0 comments on commit 4af572c

Please sign in to comment.