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 all commits
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
1 change: 1 addition & 0 deletions app/assets/images/logos/houdini-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions app/controllers/errors_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/main/LICENSE

class ErrorsController < ActionController::Base
def not_found
render status: 404
end

def internal_server_error
render status: 500
end

def unprocessable
render status: 422
end
end
10 changes: 7 additions & 3 deletions public/500.html → app/views/errors/internal_server.html.erb
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<!-- License: CC0-1.0 -->
<%# app/views/errors/internal_server.html.erb %>
fellipepcs marked this conversation as resolved.
Show resolved Hide resolved

<%- # License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/main/LICENSE -%>

<head>
<link rel="icon" href="/favicon.ico"/>
<link rel="icon" href="/app/assets/images/favicon.ico/>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/[email protected]">
<title>CommitChange - 500</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
Expand All @@ -10,7 +14,7 @@
<main>
<div>
<a title='Back to homepage' href='/'>
<img src='/svgs/houdini-logo.svg'>
<%= image_tag '/app/assets/images/logos/houdini-logo', alt:"Houdini logo" %>
</a>
<h4>Oops... something went wrong.</h4>
</div>
Expand Down
11 changes: 7 additions & 4 deletions public/404.html → app/views/errors/not_found.html.erb
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<!-- License: CC0-1.0 -->
<%# app/views/errors/not_found.html.erb %>

<%- # License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/main/LICENSE -%>

<head>
<link rel="icon" href="/favicon.ico"/>
<link rel="icon" href="/app/assets/images/favicon.ico/"/>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/[email protected]">
<title>Houdini Project - 404</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
Expand All @@ -10,7 +14,7 @@
<main>
<div>
<a title='Back to homepage' href='/'>
<img src='/svgs/houdini-logo.svg'>
<%= image_tag '/app/assets/images/logos/houdini-logo', alt:"Houdini logo" %>
</a>
<h4>Oops... couldn't find that page.</h4>
</div>
Expand Down Expand Up @@ -46,4 +50,3 @@ <h4>Oops... couldn't find that page.</h4>
transform: translateY(-50%);
}
</style>

10 changes: 7 additions & 3 deletions public/422.html → app/views/errors/unprocessable.html.erb
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<!-- License: CC0-1.0 -->
<%# app/views/errors/unprocessable.html.erb %>

<%- # License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/main/LICENSE -%>

<head>
<link rel="icon" href="/favicon.ico"/>
<link rel="icon" href="/app/assets/images/favicon.ico/"/>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/[email protected]">
<title>Houdini Project - 422</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
Expand All @@ -10,7 +14,7 @@
<main>
<div>
<a title='Back to homepage' href='/'>
<img src='/svgs/houdini-logo.svg'>
<%= image_tag '/app/assets/images/logos/houdini-logo', alt:"Houdini logo" %>
</a>
<h4>Oops... that request can't be processed.</h4>
</div>
Expand Down
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'

# Error Routes

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


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