gitosis error handle
This commit is contained in:
parent
d7ea9052f1
commit
ec9e54ea94
7 changed files with 50 additions and 8 deletions
|
@ -4,6 +4,10 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
helper_method :abilities, :can?
|
||||
|
||||
rescue_from Gitosis::AccessDenied do |exception|
|
||||
render :file => File.join(Rails.root, "public", "gitosis_error"), :layout => false
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def abilities
|
||||
|
|
5
app/controllers/errors_controller.rb
Normal file
5
app/controllers/errors_controller.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class ErrorsController < ApplicationController
|
||||
def gitosis
|
||||
render :file => File.join(Rails.root, "public", "gitosis_error"), :layout => false
|
||||
end
|
||||
end
|
|
@ -105,6 +105,8 @@ class ProjectsController < ApplicationController
|
|||
format.json { render json: @project.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
rescue Gitosis::AccessDenied
|
||||
render :js => "location.href = '#{errors_gitosis_path}'" and return
|
||||
rescue StandardError => ex
|
||||
@project.errors.add(:base, "Cant save project. Please try again later")
|
||||
respond_to do |format|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue