Merge pull request #174 from HojouFotytu/develop

Display Error on page
This commit is contained in:
HojouFotytu 2019-11-22 12:35:53 +09:00 committed by GitHub
commit 1c8a4b1c8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -2323,8 +2323,6 @@ namespace Core.Main
}
}
this.Log.DoLogInfo("DCA ProfitPercentage Label:" + ProfitPercentageLabel);
// Get configured DCA triggers
for (int dca = 1; dca <= maxDCALevel; dca++)
{

View File

@ -14,3 +14,8 @@
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
@if (Model.Exception != null) {
<h2>@Model.Exception.Error.Message</h2>
<p>@Model.Exception.Error.StackTrace</p>
}

View File

@ -7,16 +7,22 @@ namespace Monitor.Pages
public class ErrorModel : PageModel
{
public string RequestId { get; set; }
public IExceptionHandlerFeature Exception = null;
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
public void OnGet()
{
Exception = HttpContext.Features.Get<IExceptionHandlerFeature>();
var exceptionFeature = HttpContext.Features.Get<IExceptionHandlerPathFeature>();
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
Logger.WriteException(exceptionFeature.Error, "An error occurred whilst requesting " + exceptionFeature.Path);
string errorString = exceptionFeature.Error.ToString();
if (!(errorString.Contains("is being used") || errorString.Contains("an unexpected character was encountered"))) {
Logger.WriteException(exceptionFeature.Error, "An error occurred whilst requesting " + exceptionFeature.Path);
}
}
}
}