Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandx <dmitriy.zaporozhets@gmail.com>2012-06-01 00:36:52 +0400
committerrandx <dmitriy.zaporozhets@gmail.com>2012-06-01 00:36:52 +0400
commit17d4cac2080eb0c33d5daa5fc8174377b82bbc00 (patch)
tree8318f410a2b545bbe9f9e5893d518c852a7f1f0b
parenta719bfc9313545bbba5ae2479790b8902d98bb3e (diff)
Rescue encoding error on controller level
-rw-r--r--app/controllers/application_controller.rb4
-rw-r--r--app/views/errors/encoding.html.haml6
2 files changed, 10 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index a96c59b6787..f311f8aee0d 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -9,6 +9,10 @@ class ApplicationController < ActionController::Base
render "errors/gitolite", :layout => "error"
end
+ rescue_from Encoding::CompatibilityError do |exception|
+ render "errors/encoding", :layout => "error", :status => 404
+ end
+
rescue_from ActiveRecord::RecordNotFound do |exception|
render "errors/not_found", :layout => "error", :status => 404
end
diff --git a/app/views/errors/encoding.html.haml b/app/views/errors/encoding.html.haml
new file mode 100644
index 00000000000..c5cd2dd5c8b
--- /dev/null
+++ b/app/views/errors/encoding.html.haml
@@ -0,0 +1,6 @@
+.alert-message.block-message.error
+ %h3 Encoding Error
+ %hr
+ %p
+ Page cant be loaded cause of encoding error
+