-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dynamic 400/404/406/422/500 error pages
Just for something a bit friendlier and a bit more on-theme than the standard error pages that come with Rails. Of note: the 404 page helps point out if perhaps a typo was made in the URL. These views are copied over from another project of mine, but also customized to fit this project better. Also, links to each of these views is available in the UI Portal under a new "Error Pages" page.
- Loading branch information
Paul DobbinSchmaltz
committed
Nov 11, 2024
1 parent
f143a16
commit fa0d9b5
Showing
16 changed files
with
150 additions
and
711 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
class ErrorsController < ApplicationController | ||
# 400 | ||
def bad_request | ||
render(status: :bad_request) | ||
end | ||
|
||
# 404 | ||
def not_found | ||
render(status: :not_found) | ||
end | ||
|
||
# 406 | ||
def unsupported_browser | ||
render(status: :not_acceptable) | ||
end | ||
|
||
# 422 | ||
def unprocessable_entity | ||
render(status: :unprocessable_entity) | ||
end | ||
|
||
# 500 | ||
def internal_server_error | ||
render(status: :internal_server_error) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
class UIPortal::ErrorPagesController < UIPortal::BaseController | ||
def show | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div | ||
class=" | ||
container mx-auto | ||
pt-6 md:pt-12 space-y-12 | ||
text-center | ||
" | ||
> | ||
<h1 class="text-9xl text-red-500 dark:text-red-500"> | ||
400 | ||
</h1> | ||
|
||
<h2 class="h3 font-normal text-5xl"> | ||
Bad Request | ||
</h2> | ||
|
||
<p>Please try again in a minute.</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div | ||
class=" | ||
container mx-auto | ||
pt-6 md:pt-12 space-y-12 | ||
text-center | ||
" | ||
> | ||
<h1 class="text-9xl text-red-500 dark:text-red-500"> | ||
500 | ||
</h1> | ||
|
||
<h2 class="h3 font-normal text-5xl"> | ||
Unexpected Error | ||
</h2> | ||
|
||
<p>Please try again in a minute.</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div | ||
class=" | ||
container mx-auto | ||
pt-6 md:pt-12 space-y-12 | ||
text-center | ||
" | ||
> | ||
<h1 class="text-9xl text-amber-500 dark:text-amber-500"> | ||
404 | ||
</h1> | ||
|
||
<h2 class="h3 font-normal text-5xl"> | ||
Page Not Found | ||
</h2> | ||
|
||
<div class="space-y-6"> | ||
<p>If the URL was manually entered, please check for typos:</p> | ||
<code class="inline-block"><%= request.original_fullpath %></code> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div | ||
class=" | ||
container mx-auto | ||
pt-6 md:pt-12 space-y-12 | ||
text-center | ||
" | ||
> | ||
<h1 class="text-9xl text-red-500 dark:text-red-500"> | ||
422 | ||
</h1> | ||
|
||
<h2 class="h3 font-normal text-5xl"> | ||
Unprocessable Entity | ||
</h2> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div | ||
class=" | ||
container mx-auto | ||
pt-6 md:pt-12 space-y-12 | ||
text-center | ||
" | ||
> | ||
<h1 class="text-9xl text-red-500 dark:text-red-500"> | ||
406 | ||
</h1> | ||
|
||
<h2 class="h3 font-normal text-5xl"> | ||
Unsupported Browser | ||
</h2> | ||
|
||
<div class="space-y-10"> | ||
<p>Your browser is not supported.</p> | ||
<p>Please upgrade your browser to continue.</p> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<% title("Error Pages") %> | ||
|
||
<div class="container mx-auto space-y-12"> | ||
<h1><%= title %></h1> | ||
|
||
<ul class="space-y-1"> | ||
<li><%= link_to("400: Bad Request", "/400") %></li> | ||
<li><%= link_to("404: Not Found", "/404") %></li> | ||
<li><%= link_to("406: Unsupported Browser", "/406") %></li> | ||
<li><%= link_to("422: Unprocessable Entity", "/422") %></li> | ||
<li><%= link_to("500: Internal Server Error", "/500") %></li> | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
Rails.application.configure do | ||
config.exceptions_app = routes | ||
config.action_dispatch.show_exceptions = :all | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.