Commit 17d4cac2080eb0c33d5daa5fc8174377b82bbc00

Authored by randx
1 parent a719bfc9

Rescue encoding error on controller level

app/controllers/application_controller.rb
@@ -9,6 +9,10 @@ class ApplicationController < ActionController::Base @@ -9,6 +9,10 @@ class ApplicationController < ActionController::Base
9 render "errors/gitolite", :layout => "error" 9 render "errors/gitolite", :layout => "error"
10 end 10 end
11 11
  12 + rescue_from Encoding::CompatibilityError do |exception|
  13 + render "errors/encoding", :layout => "error", :status => 404
  14 + end
  15 +
12 rescue_from ActiveRecord::RecordNotFound do |exception| 16 rescue_from ActiveRecord::RecordNotFound do |exception|
13 render "errors/not_found", :layout => "error", :status => 404 17 render "errors/not_found", :layout => "error", :status => 404
14 end 18 end
app/views/errors/encoding.html.haml 0 → 100644
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
  1 +.alert-message.block-message.error
  2 + %h3 Encoding Error
  3 + %hr
  4 + %p
  5 + Page cant be loaded cause of encoding error
  6 +