void IExceptionHandler <Exception> .Handle(Exception exception) { IsNotFound = false; IsUnauthorized = false; IsVisible = true; if (IsSkipped(exception)) { IsVisible = false; return; } if (exception is AggregateException aggregateException) { exception = aggregateException.InnerException; } Log.Debug(exception.ToString()); if (exception == null) { Title = "Unspecified weird error"; Message = "We didn't get any details about the problem that occurred. So we can't show you. Apologies for inconvenience."; } else if (exception.Message == "TypeError: Failed to fetch") { SetNetworkErrorMessage(); } else if (exception is HttpRequestException httpException) { if (IsHttpResponseStatusCode(httpException, 401)) { IsUnauthorized = true; } if (IsHttpResponseStatusCode(httpException, 503)) { Title = "Server Update"; Message = "The server part of the application is currently being updated. Please come back later."; } else if (IsHttpResponseStatusCode(httpException, 404)) { Title = "Not found"; Message = "Requested resource was not found on the server."; } else if (IsHttpResponseStatusCode(httpException, 402)) { PremiumModal.Show(); IsVisible = false; } else if (IsHttpResponseStatusCode(httpException, 422)) { ReadOnlyModal.Show(); IsVisible = false; } else { SetNetworkErrorMessage(); } } else if (exception is UnauthorizedAccessException) { IsUnauthorized = true; } else if (exception is FreeLimitsReachedExceptionException) { PremiumModal.Show(); IsVisible = false; } else { Title = exception.GetType().Name; Message = exception.Message; } StateHasChanged(); if (IsVisible) { WindowInterop.ScrollTo(0, 0); } }
private void OnFreeLimitsNotifierShow() => PremiumModal.Show();