diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-04-10 12:53:06 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-04-10 12:53:06 +0100 |
commit | b0fbe646f386b866791fbb321d6fa183bb4a6517 (patch) | |
tree | c2a694bd2137cbb7ceb019864014b7aff0b7ea7b /app/controllers/application_controller.rb | |
parent | d1f2d56834688c5b449ac8c50b67dff0672ca074 (diff) |
Rescue from non-numeric page parameter exceptions
will_paginate intentionally throws an ArgumentError when a non-numeric page
parameter is used. Conveniently, they tag it with WillPaginate::InvalidPage,
so here we rescue with a 404.
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 410778d9a..ba086cfa3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -129,7 +129,7 @@ class ApplicationController < ActionController::Base @exception_class = exception.class.to_s @exception_message = exception.message case exception - when ActiveRecord::RecordNotFound, RouteNotFound + when ActiveRecord::RecordNotFound, RouteNotFound, WillPaginate::InvalidPage @status = 404 sanitize_path(params) when PermissionDenied |