From d9295c46a5cf27fc36c833298e512dd21b2fb237 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 5 Apr 2017 10:05:06 -0400 Subject: [PATCH] Custom error page. --- Project-Unite/Views/Shared/Error.cshtml | 62 +++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/Project-Unite/Views/Shared/Error.cshtml b/Project-Unite/Views/Shared/Error.cshtml index be55b17..0ffa3ed 100644 --- a/Project-Unite/Views/Shared/Error.cshtml +++ b/Project-Unite/Views/Shared/Error.cshtml @@ -7,3 +7,65 @@

Error.

An error occurred while processing your request.

+

Error summary:

+ +

@Model.Exception.Message

+ +

Stacktrace (for nerdy Shifters):

+ +
+
+    @Model.Exception.StackTrace
+
+
+ +

Full exception details:

+ +
+
+    @Model.Exception.ToString()
+
+
+ +

Requested action: @Html.Raw(Model.ControllerName + "/" + Model.ActionName)

+ +

What can you do?

+ +
+
+

If you are a user...

+ +
    +
  • Try again in a bit - there may be a temporary issue preventing this request from going through.
  • +
  • Try another page - does this error show on other pages?
  • +
  • Give us a bit of time - We already saw this error - it got sent to us when you received this page.
  • +
+
+
+

If you're an admin or a dev...

+ +
    +
  • Check your Audit Logs - if you are an admin, head over to @Html.ActionLink("this link", "Logs", "Admin") - the crash has been logged.
  • +
  • Check the GitHub Issues page - there may be a bugreport. View issues.
  • +
+
+
+ +@{ + 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("Crash report
"); + sb.AppendLine("
"); + sb.AppendLine("
");
+    sb.AppendLine(Model.Exception.ToString());
+    sb.AppendLine("

"); + sb.Append("Requested action: "); + sb.Append(Model.ControllerName + "/" + Model.ActionName); + sb.AppendLine(""); + auditlog.Description = sb.ToString(); + db.AuditLogs.Add(auditlog); + db.SaveChanges(); +} \ No newline at end of file