summaryrefslogtreecommitdiff
path: root/Project-Unite/Views/Shared/Error.cshtml
blob: 0ffa3ed42f460fcdd2f41a488843aadbad2c40cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
@model System.Web.Mvc.HandleErrorInfo

@{
    ViewBag.Title = "Error";
}

<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

<h2>Error summary:</h2>

<p><strong>@Model.Exception.Message</strong></p>

<h3>Stacktrace (for nerdy Shifters):</h3>

<pre>
<code class="language-csharp">
    @Model.Exception.StackTrace
</code>
</pre>

<h3>Full exception details:</h3>

<pre>
<code>
    @Model.Exception.ToString()
</code>
</pre>

<p><em><strong>Requested action: </strong>@Html.Raw(Model.ControllerName + "/" + Model.ActionName)</em></p>

<h2>What can you do?</h2>

<div class="row">
    <div class="col-xs-6">
        <h4>If you are a user...</h4>

        <ul>
            <li>Try again in a bit - there may be a temporary issue preventing this request from going through.</li>
            <li>Try another page - does this error show on other pages?</li>
            <li>Give us a bit of time - We already saw this error - it got sent to us when you received this page.</li>
        </ul>
    </div>
    <div class="col-xs-6">
        <h4>If you're an admin or a dev...</h4>

        <ul>
            <li>Check your Audit Logs - if you are an admin, head over to @Html.ActionLink("this link", "Logs", "Admin") - the crash has been logged.</li>
            <li>Check the GitHub Issues page - there may be a bugreport. <a href="http://github.com/MichaelTheShifter/Project-Unite/issues">View issues.</a></li>
        </ul>
    </div>
</div>

@{ 
    var db = new Project_Unite.Models.ApplicationDbContext();
    var auditlog = new Project_Unite.Models.AuditLog("crash_reporter_daemon", Project_Unite.Models.AuditLogLevel.Admin, "");

    var sb = new System.Text.StringBuilder();

    sb.AppendLine("<strong>Crash report</strong><br/>");
    sb.AppendLine("<br/>");
    sb.AppendLine("<pre><code class=\"language-csharp\">");
    sb.AppendLine(Model.Exception.ToString());
    sb.AppendLine("</code></pre><br/>");
    sb.Append("<strong>Requested action: ");
    sb.Append(Model.ControllerName + "/" + Model.ActionName);
    sb.AppendLine("</strong>");
    auditlog.Description = sb.ToString();
    db.AuditLogs.Add(auditlog);
    db.SaveChanges();
}