diff --git a/app/assets/stylesheets/errors.scss b/app/assets/stylesheets/errors.scss
new file mode 100644
index 0000000..151c161
--- /dev/null
+++ b/app/assets/stylesheets/errors.scss
@@ -0,0 +1,26 @@
+// Place all the styles related to the errors controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: https://sass-lang.com/
+body {
+ background: #f5f5f5;
+ font-family: 'Noto Sans', sans-serif;
+ margin: 0;
+ color: #4c5667;
+ overflow-x: hidden !important;
+ padding-top: 40px;
+ padding-bottom: 40px;
+}
+
+.message-box h1 {
+ color: #252932;
+ font-size: 80px;
+ font-weight: 700;
+ margin-left: 18px;
+ line-height: 80px;
+ text-shadow: rgba(61, 61, 61, 0.3) 1px 1px, rgba(61, 61, 61, 0.2) 2px 2px, rgba(61, 61, 61, 0.3) 3px 3px;
+ padding-top: 25px;
+}
+
+.message {
+ font-size: 18px;
+}
\ No newline at end of file
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb
new file mode 100644
index 0000000..4388fcc
--- /dev/null
+++ b/app/controllers/errors_controller.rb
@@ -0,0 +1,10 @@
+class ErrorsController < ApplicationController
+ def not_found
+ render status: 404
+ end
+
+
+ def internal_server_error
+ render status: 500
+ end
+end
diff --git a/app/helpers/errors_helper.rb b/app/helpers/errors_helper.rb
new file mode 100644
index 0000000..8e3b415
--- /dev/null
+++ b/app/helpers/errors_helper.rb
@@ -0,0 +1,2 @@
+module ErrorsHelper
+end
diff --git a/app/views/errors/internal_server_error.html.erb b/app/views/errors/internal_server_error.html.erb
new file mode 100644
index 0000000..22e2f72
--- /dev/null
+++ b/app/views/errors/internal_server_error.html.erb
@@ -0,0 +1,28 @@
+
+
Oops! Page Not Found
+
Sorry but the page you are looking for does not exist.
+
<%= link_to "Go Back Home", root_path, class: "btn btn-info pl-5 pr-5" %>
+
diff --git a/config/application.rb b/config/application.rb
index 75e0d2a..bac4b6b 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -10,7 +10,8 @@ module Shiftwork2
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
-
+ config.exceptions_app = self.routes
+
# Set official app timezone
config.time_zone = "UTC"
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 66df51f..428c0e7 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -10,7 +10,7 @@
config.eager_load = false
# Show full error reports.
- config.consider_all_requests_local = true
+ config.consider_all_requests_local = false
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
diff --git a/config/routes.rb b/config/routes.rb
index b98f440..581b2c0 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,8 @@
Rails.application.routes.draw do
+ get 'errors/not_found'
+ get 'errors/internal_server_error'
+ match "/404", to: "errors#not_found", via: :all
+ match "/500", to: "errors#internal_server_error", via: :all
# match '/404', to: 'application#render_not_found', via: :all
root 'users#index'
diff --git a/public/404.html b/public/404.html
deleted file mode 100644
index 2be3af2..0000000
--- a/public/404.html
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
-
-
-
We're sorry, but something went wrong.
-
-
If you are the application owner check the logs for more information.
-
-
-
diff --git a/spec/helpers/errors_helper_spec.rb b/spec/helpers/errors_helper_spec.rb
new file mode 100644
index 0000000..e359203
--- /dev/null
+++ b/spec/helpers/errors_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the ErrorsHelper. For example:
+#
+# describe ErrorsHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe ErrorsHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/requests/errors_spec.rb b/spec/requests/errors_spec.rb
new file mode 100644
index 0000000..436204d
--- /dev/null
+++ b/spec/requests/errors_spec.rb
@@ -0,0 +1,18 @@
+require 'rails_helper'
+
+RSpec.describe "Errors", type: :request do
+ describe "GET /not_found" do
+ it "returns http success" do
+ get "/errors/not_found"
+ expect(response).to have_http_status(:success)
+ end
+ end
+
+ describe "GET /internal_server_error" do
+ it "returns http success" do
+ get "/errors/internal_server_error"
+ expect(response).to have_http_status(:success)
+ end
+ end
+
+end
diff --git a/spec/views/errors/internal_server_error.html.erb_spec.rb b/spec/views/errors/internal_server_error.html.erb_spec.rb
new file mode 100644
index 0000000..2ae6ed2
--- /dev/null
+++ b/spec/views/errors/internal_server_error.html.erb_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe "errors/internal_server_error.html.erb", type: :view do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/views/errors/not_found.html.erb_spec.rb b/spec/views/errors/not_found.html.erb_spec.rb
new file mode 100644
index 0000000..4e0eed4
--- /dev/null
+++ b/spec/views/errors/not_found.html.erb_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe "errors/not_found.html.erb", type: :view do
+ pending "add some examples to (or delete) #{__FILE__}"
+end