chore: graph ql errors more info. Plus vehicle dictionary mapping error fix

This commit is contained in:
Mikhail Shabanov committed 2022-08-20 17:16:57 +02:00
1 parent 7d524fcdcd
commit 416f631d3f
7 files changed
+20 -15

No files matched your search

@@ -57,7 +57,7 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
}
catch (System.Exception e)
{
Notifications.ReportError("Can not get data from backend", e.Message);
Notifications.ReportError("Can not get data from backend", e.Message, e.StackTrace);
}
}
}
@@ -76,7 +76,7 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
{
TreeItems.Clear();
Connections.Clear();
var vehiclesTree = VehiclesLibrary.Where(v => v.IsPremium == false).ToList();
var vehiclesTree = VehiclesLibrary?.Where(v => v != null && v.IsPremium == false).ToList();
for (int tier = 1; tier < 11; tier++)
{
var vehiclesByTier = vehiclesTree.Where(v => v.Tier == tier).ToList();
@@ -279,7 +279,7 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
}
catch (System.Exception e)
{
Notifications.ReportError("Can not get data from backend", e.Message);
Notifications.ReportError("Can not get data from backend", e.Message, e.StackTrace);
}
}
@@ -132,6 +132,10 @@ namespace WotBlitzStatisticsPro.Blazor.Services
{
messages.Add(message.ToString());
}
else
{
messages.Add(realError);
}
}
}
}
@@ -140,7 +144,7 @@ namespace WotBlitzStatisticsPro.Blazor.Services
if (messages.Count > 0)
{
_notificationsService.ReportError("Backend error",string.Join(";", messages));
_notificationsService.ReportError("Backend error",string.Join(";", messages), null);
}
}
}
@@ -14,6 +14,6 @@ namespace WotBlitzStatisticsPro.Blazor.Services
void ReportInfo(string summary, string message);
void ReportWarning(string summary, string message);
void ReportError(string summary, string message);
void ReportError(string summary, string message, string? stacktrace);
}
}
@@ -39,13 +39,14 @@ namespace WotBlitzStatisticsPro.Blazor.Services
_jsRuntime.InvokeVoidAsync("console.warn", summary, message);
}
public void ReportError(string summary, string message)
public void ReportError(string summary, string message, string? stacktrace)
{
Type = NotificationType.Error;
Message = message;
Summary = summary;
MessageArrived?.Invoke();
_jsRuntime.InvokeVoidAsync("console.error", summary, message);
Console.WriteLine(message);
_jsRuntime.InvokeVoidAsync("console.error", summary, string.IsNullOrEmpty(stacktrace) ? message : $"{message}; {stacktrace}");
}
}
}