Improve error reporting in create invoice page (#3065)

This commit is contained in:
Nicolas Dorier
2021-11-04 17:12:17 +09:00
committed by GitHub
parent 51f0c2a5f8
commit d39ae86915
3 changed files with 12 additions and 4 deletions

View File

@@ -906,8 +906,11 @@ namespace BTCPayServer.Controllers
} }
catch (BitpayHttpException ex) catch (BitpayHttpException ex)
{ {
Logs.PayServer.LogError(ex, $"Invoice creation failed due to invalid currency {model.Currency}"); this.TempData.SetStatusMessageModel(new StatusMessageModel()
ModelState.TryAddModelError(nameof(model.Currency), "Please make sure you entered a valid currency symbol, a rate provider is configured in store settings, and your configured rate provider is both online and providing rates for your selected currency."); {
Severity = StatusMessageModel.StatusSeverity.Error,
Message = ex.Message
});
return View(model); return View(model);
} }
} }

View File

@@ -409,6 +409,11 @@ namespace BTCPayServer.Controllers
return null; return null;
} }
} }
else
{
var suffix = currentRateToCrypto?.EvaluatedRule is string s ? $" ({s})" : string.Empty;
logs.Write($"{logPrefix} This payment method should be created only if the amount of this invoice is in proper range. However, we are unable to fetch the rate of those limits. {suffix}", InvoiceEventData.EventSeverity.Warning);
}
} }
#pragma warning disable CS0618 #pragma warning disable CS0618

View File

@@ -1,4 +1,4 @@
@{ @{
var parsedModel = TempData.GetStatusMessageModel(); var parsedModel = TempData.GetStatusMessageModel();
} }
@@ -13,7 +13,7 @@
} }
@if (!string.IsNullOrEmpty(parsedModel.Message)) @if (!string.IsNullOrEmpty(parsedModel.Message))
{ {
@parsedModel.Message <span style="white-space: pre-wrap;">@parsedModel.Message</span>
} }
@if (!string.IsNullOrEmpty(parsedModel.Html)) @if (!string.IsNullOrEmpty(parsedModel.Html))
{ {