Skip to content

Commit

Permalink
Redesigned error boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoCoderMatrix86 committed Apr 8, 2024
1 parent 4b3cc99 commit ffbf649
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
6 changes: 4 additions & 2 deletions AudioCuesheetEditor/Resources/Localization/MainLayout/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"translations": {
"About": "Über",
"An error occured": "Ein Fehler ist aufgetreten!",
"An error has occured in this applciation. Please report this error with as much details as possible here. Afterwards you can reload the application.": "Es ist ein Fehler in der Anwendung aufgetreten. Bitte melden Sie diesen Fehler unter Angabe von möglichst vielen Details hier: <a href=\"https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=unreviewed+bug&template=bug_report.md&title=\" target=\"_blank\">https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=unreviewed+bug&template=bug_report.md&title=</a>. Anschließend können Sie die Anwendung <a href=\"\" class=\"reload\">neu laden</a>.",
"An error has occured in this application. Please report this error with as much details as possible here: <a href=\"https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=bug&template=bug_report.md&title=\" target=\"_blank\">https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=unreviewed+bug&template=bug_report.md&title=</a>.": "Es ist ein Fehler in der Anwendung aufgetreten. Bitte melden Sie diesen Fehler unter Angabe von möglichst vielen Details hier: <a href=\"https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=unreviewed+bug&template=bug_report.md&title=\" target=\"_blank\">https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=unreviewed+bug&template=bug_report.md&title=</a>.",
"Help": "Hilfe",
"Undo last change": "Letzte Änderung Rückgängig machen",
"Redo last change": "Letzte Änderung wiederherstellen",
Expand Down Expand Up @@ -69,6 +69,8 @@
"Length": "Länge",
"Flags": "Markierungen",
"PreGap": "Vorlücke",
"PostGap": "Nachlücke"
"PostGap": "Nachlücke",
"Error details": "Fehlerdetails",
"Reload application": "Applikation neu laden"
}
}
6 changes: 4 additions & 2 deletions AudioCuesheetEditor/Resources/Localization/MainLayout/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"translations": {
"About": "About",
"An error occured": "An error has occured!",
"An error has occured in this applciation. Please report this error with as much details as possible here. Afterwards you can reload the application.": "An error has occured in this applciation. Please report this error with as much details as possible here: <a href=\"https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=unreviewed+bug&template=bug_report.md&title=\" target=\"_blank\">https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=unreviewed+bug&template=bug_report.md&title=</a>. Afterwards you can <a href=\"\" class=\"reload\">reload</a> the application.",
"An error has occured in this application. Please report this error with as much details as possible here: <a href=\"https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=bug&template=bug_report.md&title=\" target=\"_blank\">https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=unreviewed+bug&template=bug_report.md&title=</a>.": "An error has occured in this application. Please report this error with as much details as possible here: <a href=\"https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=bug&template=bug_report.md&title=\" target=\"_blank\">https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=unreviewed+bug&template=bug_report.md&title=</a>.",
"Help": "Help",
"Undo last change": "Undo last change",
"Redo last change": "Redo last change",
Expand Down Expand Up @@ -69,6 +69,8 @@
"Length": "Length",
"Flags": "Flags",
"PreGap": "Pregap",
"PostGap": "Postgap"
"PostGap": "Postgap",
"Error details": "Error details",
"Reload application": "Reload application"
}
}
16 changes: 12 additions & 4 deletions AudioCuesheetEditor/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,11 @@ along with Foobar. If not, see
</CascadingValue>
</ChildContent>
<ErrorContent>
<Heading Size="HeadingSize.Is3" TextColor="TextColor.Danger">@_localizer["An error occured"]</Heading>
<Paragraph>@((MarkupString)_localizer["An error has occured in this applciation. Please report this error with as much details as possible here. Afterwards you can reload the application."])</Paragraph>
<Heading Size="HeadingSize.Is2" TextColor="TextColor.Danger">@_localizer["An error occured"]</Heading>
<Paragraph>@((MarkupString)_localizer["An error has occured in this application. Please report this error with as much details as possible here: <a href=\"https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=bug&template=bug_report.md&title=\" target=\"_blank\">https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/new?assignees=&labels=unreviewed+bug&template=bug_report.md&title=</a>."])</Paragraph>
<Heading Size="HeadingSize.Is4">@_localizer["Error details"]</Heading>
<Paragraph>@context</Paragraph>
<Button Color="Color.Primary" Clicked="ReloadApplication">@_localizer["Reload application"]</Button>
</ErrorContent>
</ErrorBoundary>

Expand Down Expand Up @@ -560,8 +563,7 @@ along with Foobar. If not, see
{
_logger.LogInformation("restartApplicationDelegate");
modalDialog.Confirmed -= restartApplicationDelegate;
await _jsRuntime.InvokeVoidAsync("removeBeforeunload");
_navigationManager.NavigateTo(_navigationManager.Uri, true);
await ReloadApplication();
};
modalDialog.Confirmed += restartApplicationDelegate;
await modalDialog.ShowModal();
Expand Down Expand Up @@ -844,4 +846,10 @@ along with Foobar. If not, see
}
return Task.CompletedTask;
}

async Task ReloadApplication()
{
await _jsRuntime.InvokeVoidAsync("removeBeforeunload");
_navigationManager.NavigateTo(_navigationManager.Uri, true);
}
}

0 comments on commit ffbf649

Please sign in to comment.