Respond with not found on missing tenants
Just like we respond with "not found" for any other record. This improves the user experience because with the "Not found" error message people realize the URL is wrong instead of thinking that they broke the application.
This commit is contained in:
@@ -48,6 +48,7 @@ module Consul
|
|||||||
|
|
||||||
# Handle custom exceptions
|
# Handle custom exceptions
|
||||||
config.action_dispatch.rescue_responses["FeatureFlags::FeatureDisabled"] = :forbidden
|
config.action_dispatch.rescue_responses["FeatureFlags::FeatureDisabled"] = :forbidden
|
||||||
|
config.action_dispatch.rescue_responses["Apartment::TenantNotFound"] = :not_found
|
||||||
|
|
||||||
# Store uploaded files on the local file system (see config/storage.yml for options).
|
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||||
config.active_storage.service = :local
|
config.active_storage.service = :local
|
||||||
|
|||||||
@@ -173,4 +173,12 @@ describe "Multitenancy", :seed_tenants do
|
|||||||
expect(page).not_to have_css "html.tenant-public"
|
expect(page).not_to have_css "html.tenant-public"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "Shows the not found page when accessing a non-existing tenant", :show_exceptions do
|
||||||
|
with_subdomain("jupiter") do
|
||||||
|
visit root_path
|
||||||
|
|
||||||
|
expect(page).to have_title "Not found"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user