Robert Marshall пре 3 година
родитељ
комит
4e2dee4d03

+ 3 - 12
src/Website/Controllers/ErrorController.cs

@@ -7,21 +7,12 @@ namespace Website.Controllers
 {
 	public class ErrorController : Controller
 	{
-
-		public IActionResult BlowUp() {
-			throw new Exception();
-		}
+		public IActionResult BlowUp() => throw new Exception();
 
 		[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
-		public IActionResult ServerError()
-		{
-			return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
-		}
+		public IActionResult ServerError() => View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
 
 		[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
-		public IActionResult PageNotFound()
-		{
-			return View();
-		}
+		public IActionResult PageNotFound() => View();
 	}
 }

+ 10 - 2
src/Website/Views/Error/PageNotFound.cshtml

@@ -3,5 +3,13 @@
 	ViewData["Title"] = "404 Not Found";
 }
 
-<h1>404 Not Found - page unavailable.</h1>
-This page cannot be found.
+<h2>This page cannot be found.</h2>
+<p>
+	If you got here from a bookmark, or typed it in, then please check you have the correct link.
+</p>
+<p>
+	If you got here from another website, it's probably worth letting them know they've got a broken link.
+</p>
+<p>
+	If you got here from a link on this website, then it's definitely worth letting me know I've got a broken link.
+</p>

+ 4 - 14
src/Website/Views/Error/ServerError.cshtml

@@ -3,23 +3,13 @@
 	ViewData["Title"] = "Error";
 }
 
-<h1 class="text-danger">Error.</h1>
-<h2 class="text-danger">An error occurred while processing your request.</h2>
-
+<h2>An error occurred while processing your request.</h2>
+<p>
+	If you have a means to contact me I'd appreciate you letting me know something broke.
+</p>
 @if (Model.ShowRequestId)
 {
 	<p>
 		<strong>Request ID:</strong> <code>@Model.RequestId</code>
 	</p>
 }
-
-<h3>Development Mode</h3>
-<p>
-	Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
-</p>
-<p>
-	<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
-	It can result in displaying sensitive information from exceptions to end users.
-	For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
-	and restarting the app.
-</p>