81 lines
No EOL
2.5 KiB
Text
81 lines
No EOL
2.5 KiB
Text
@using Microsoft.JSInterop
|
|
@inject IJSRuntime JS
|
|
@namespace LANCommander.UI.Components
|
|
|
|
<ErrorBoundary>
|
|
<ChildContent>
|
|
@Body
|
|
</ChildContent>
|
|
<ErrorContent>
|
|
<Result Status="ResultStatus.Error"
|
|
Title="@Title"
|
|
SubTitle="@RandomQuip"
|
|
Class="crash-error">
|
|
<Extra>
|
|
@if (Extra != null)
|
|
{
|
|
@Extra
|
|
}
|
|
|
|
<Button OnClick="() => CopyError(context)">Copy Error</Button>
|
|
</Extra>
|
|
<ChildContent>
|
|
<code>
|
|
@context.Message
|
|
@context.StackTrace
|
|
</code>
|
|
</ChildContent>
|
|
</Result>
|
|
</ErrorContent>
|
|
</ErrorBoundary>
|
|
|
|
@code {
|
|
[Parameter] public string Title { get; set; }
|
|
[Parameter] public RenderFragment Body { get; set; }
|
|
[Parameter] public RenderFragment Extra { get; set; }
|
|
|
|
string RandomQuip = "";
|
|
|
|
string[] CrashQuips = new[]
|
|
{
|
|
"You Died.",
|
|
"Snake? SNAAAAAAKE!",
|
|
"WASTED",
|
|
"Major fracture detected",
|
|
"The past is a gaping hole. You try to run from it, but the more you run, the deeper, the darker, the bigger it gets.",
|
|
"Your town center has been destroyed",
|
|
"Your forces are under attack!",
|
|
"You have lost the lead",
|
|
"Terrorists Win",
|
|
"War... War never changes.",
|
|
"You have died of dysentery",
|
|
"You have failed to restore the books. The Ages are lost.",
|
|
"Player was splattered by a demon",
|
|
"Sure, blame it on your ISP",
|
|
"Baba is no more",
|
|
"Guests are complaining they are lost",
|
|
"The darkness has overcome you",
|
|
"Subject: Gordon Freeman. Status: Terminated",
|
|
"Mission failed: You were spotted.",
|
|
"Critical damage! Eject, eject!",
|
|
"Your minions are unhappy. They are leaving.",
|
|
"The Empire has triumphed",
|
|
"Your quest has ended in failure",
|
|
"You have been eaten by a grue",
|
|
"You no mess with Lo Wang!",
|
|
"Sam was killed. Serious carnage ensues.",
|
|
"Damn, those alien bastards are gonna pay for shooting up my ride"
|
|
};
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
var randIndex = new Random().Next(0, CrashQuips.Length - 1);
|
|
|
|
RandomQuip = CrashQuips[randIndex];
|
|
}
|
|
|
|
async Task CopyError(Exception ex)
|
|
{
|
|
await JS.InvokeVoidAsync("navigator.clipboard.writeText", ex.Message + "\n" + ex.StackTrace);
|
|
}
|
|
} |