Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve errors page fix #1439

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions app/controllers/errors_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class ErrorsController < ApplicationController
fellipepcs marked this conversation as resolved.
Show resolved Hide resolved
fellipepcs marked this conversation as resolved.
Show resolved Hide resolved
def not_found
render status: 404
end

def internal_server
fellipepcs marked this conversation as resolved.
Show resolved Hide resolved
render status: 500
end

def unprocessable
render status: 422
end

def unaccetable
fellipepcs marked this conversation as resolved.
Show resolved Hide resolved
fellipepcs marked this conversation as resolved.
Show resolved Hide resolved
render status 406
end
end
3 changes: 3 additions & 0 deletions app/views/errors/internal_server.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%# app/views/errors/internal_server.html.erb %>
fellipepcs marked this conversation as resolved.
Show resolved Hide resolved

Oops... something went wrong.
3 changes: 3 additions & 0 deletions app/views/errors/not_found.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%# app/views/errors/not_found.html.erb %>

This page does not exit. Please go back
fellipepcs marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions app/views/errors/unprocessable.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%# app/views/errors/unprocessable.html.erb %>

Oops... that request can't be processed
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class Application < Rails::Application

config.active_job.queue_adapter = :good_job

config.exceptions_app = self.routes

# this works around a bug where the the webpacker proxy
# only waits 60 seconds for a compilation to happen. That's not
# fast enough on startup and Webpacker doesn't allow us to override.
Expand Down
7 changes: 7 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,13 @@
get '/css/donate-button.css' => 'widget#v1_css'
get '/css/donate-button.v2.css' => 'widget#v2_css'

# Routes
fellipepcs marked this conversation as resolved.
Show resolved Hide resolved

get '/404', to: 'errors#not_found'
fellipepcs marked this conversation as resolved.
Show resolved Hide resolved
get '/500', to: 'errors#internal_server'
get '/422', to: 'errors#unprocessable'


scope ActiveStorage.routes_prefix do
get "/blobs/redirect/:signed_id/*filename" => "active_storage/blobs/redirect#show", as: :rails_service_blob
get "/blobs/proxy/:signed_id/*filename" => "active_storage/blobs/proxy#show", as: :rails_service_blob_proxy
Expand Down
49 changes: 0 additions & 49 deletions public/404.html

This file was deleted.

48 changes: 0 additions & 48 deletions public/422.html

This file was deleted.

48 changes: 0 additions & 48 deletions public/500.html

This file was deleted.