Skip to content

Commit

Permalink
Make more clear error by the shoppingCartId from my custom client.
Browse files Browse the repository at this point in the history
  • Loading branch information
infofromca committed Jul 29, 2024
1 parent 9d60db3 commit f383c4a
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,15 @@ await _paymentProviders
}
catch (Exception exception)
{
_logger.LogError(exception, "An exception has occurred during checkout form validation.");

string error = shoppingCartId == null ?
$"An exception has occurred during checkout form validation."
: $"An exception has occurred during checkout form validation at {shoppingCartId}.";
#pragma warning disable CA2254
_logger.LogError(exception, message: error);
#pragma warning restore CA2254
var errorMessage = HttpContext.IsDevelopmentAndLocalhost()
? exception.ToString()
: T["An exception has occurred during checkout form validation."].Value;
: T[error].Value;

return Json(new { Errors = new[] { errorMessage } });
}
Expand Down

0 comments on commit f383c4a

Please sign in to comment.