commit 0e4a1d08d028ddeb5a30a45365c9d74ff0857752
parent e7c779a3de3ffe6c35b37c5542971b0c2318b91a
Author: Ryan Jeffrey <ryan@ryanmj.xyz>
Date: Wed, 23 Feb 2022 22:11:39 -0800
Only handle errors that will actually happen, new error pages
Diffstat:
4 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb
@@ -1,17 +1,9 @@
class ErrorsController < ApplicationController
def not_found
- render status: 404
+ render status: :not_found
end
def internal_server
- render status: 500
- end
-
- def unprocessable
- render status: 422
- end
-
- def unacceptable
- render status: 406
+ render status: :internal_server_error
end
end
diff --git a/app/views/errors/internal_server.html.erb b/app/views/errors/internal_server.html.erb
@@ -0,0 +1,3 @@
+<h5>Website status: Gunted</h5>
+
+<h2>Internal Server Error! :/</h2>
diff --git a/app/views/errors/not_found.html.erb b/app/views/errors/not_found.html.erb
@@ -1,2 +1 @@
-<h1>Errors#not_found</h1>
-<p>Find me in app/views/errors/not_found.html.erb</p>
+<h1>404 - Page not found! :/</h1>
diff --git a/config/routes.rb b/config/routes.rb
@@ -4,7 +4,6 @@ Rails.application.routes.draw do
# Error routes
get '/404', to: 'errors#not_found'
get '/500', to: 'errors#internal_server'
- get '/422', to: 'errors#unprocessable'
# Blog.
get '/posts', to: 'posts#blog_index'
get '/posts/:url', to: 'posts#show'