< Summary

Information
Class: Pomodoro.Web.Components.ErrorDisplay
Assembly: Pomodoro.Web
File(s): /home/runner/work/Pomodoro/Pomodoro/src/Pomodoro.Web/Components/ErrorDisplay.razor
Line coverage
100%
Covered lines: 19
Uncovered lines: 0
Coverable lines: 19
Total lines: 47
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
BuildRenderTree(...)100%11100%
get_Exception()100%11100%
get_OnRetry()100%11100%
get_JSRuntime()100%11100%
get_Logger()100%11100%
get_ErrorMessage()100%44100%
OnParametersSet()100%22100%
OnReload()100%11100%

File(s)

/home/runner/work/Pomodoro/Pomodoro/src/Pomodoro.Web/Components/ErrorDisplay.razor

#LineLine coverage
 1@using Microsoft.JSInterop
 2@using Microsoft.Extensions.Logging
 3
 4<div class="error-container">
 5    <div class="error-content">
 356        <div class="error-icon">@Constants.ErrorDisplay.ErrorIcon</div>
 357        <h3>@Constants.ErrorDisplay.ErrorTitle</h3>
 358        <p class="error-message">@ErrorMessage</p>
 9        <div class="error-actions">
 10            <button class="btn btn-primary" @onclick="OnRetry">
 3511                @Constants.ErrorDisplay.RetryButtonText
 12            </button>
 13            <button class="btn btn-secondary" @onclick="OnReload">
 3514                @Constants.ErrorDisplay.ReloadButtonText
 15            </button>
 16        </div>
 17    </div>
 18</div>
 19
 20@code {
 21    [Parameter]
 13622    public Exception? Exception { get; set; }
 23
 24    [Parameter]
 6125    public EventCallback OnRetry { get; set; }
 26
 27    [Inject]
 6928    private IJSRuntime JSRuntime { get; set; } = default!;
 29
 30    [Inject]
 10131    private ILogger<ErrorDisplay> Logger { get; set; } = default!;
 32
 3533    private string ErrorMessage => Exception?.Message ?? Constants.ErrorDisplay.DefaultErrorMessage;
 34
 35    protected override void OnParametersSet()
 3436    {
 3437        if (Exception != null)
 3338        {
 3339            Logger.LogError(Exception, Constants.Messages.LogErrorCaughtByBoundary);
 3340        }
 3441    }
 42
 43    private async Task OnReload()
 144    {
 145        await JSRuntime.InvokeVoidAsync("location.reload");
 146    }
 47}