Skip to content

redirects to main_app.root_url when folder id is invalid#103

Open
jiaola wants to merge 1 commit intoprojectblacklight:masterfrom
jiaola:redirect_root
Open

redirects to main_app.root_url when folder id is invalid#103
jiaola wants to merge 1 commit intoprojectblacklight:masterfrom
jiaola:redirect_root

Conversation

@jiaola
Copy link

@jiaola jiaola commented Nov 6, 2015

We found a problem a user tries to access a folder that doesn't exist or has been deleted. It throws an error: ActiveRecord::RecordNotFound in Blacklight::Folders::FoldersController#show

We'd like to catch this error, redirect to root_url with a helpful message. This fix does that.

This is a resubmit of the previous pull request #98

@cjcolvar
Copy link
Contributor

cjcolvar commented Nov 6, 2015

Would it be better to go to folders index instead of app home?

@jcoyne
Copy link
Member

jcoyne commented Nov 6, 2015

Rails catches the RecordNotFound errors in production mode and shows a 404 page. https://github.com/rails/rails/blob/504e5e102b847019f08c4c2d1fa30444ed9a59a0/railties/test/application/middleware/exceptions_test.rb#L35-L46 So we probably don't want your PR to prevent that from happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants