Skip to content
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
5 changes: 5 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ApplicationController < ActionController::Base
rescue_from GdsApi::HTTPNotFound, with: :cacheable_404
rescue_from GdsApi::InvalidUrl, with: :cacheable_404
rescue_from GdsApi::HTTPForbidden, with: :error_403
rescue_from GdsApi::HTTPBadRequest, with: :error_400
rescue_from RecordNotFound, with: :cacheable_404

# Because this code contains an if statement evaluated on Rails load and is just
Expand All @@ -27,6 +28,10 @@ class ApplicationController < ActionController::Base

helper_method :content_item

def error_400
error :bad_request
end

def error_403
error :forbidden
end
Expand Down
2 changes: 1 addition & 1 deletion lib/content_item_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def load_from_sources(base_path)
end

default_loader.load(base_path:)
rescue GdsApi::HTTPErrorResponse, GdsApi::InvalidUrl => e
rescue GdsApi::HTTPErrorResponse, GdsApi::InvalidUrl, GdsApi::HTTPBadRequest => e
e
end

Expand Down