diff options
| author | gitlabhq <m@gitlabhq.com> | 2011-10-10 00:15:28 +0300 |
|---|---|---|
| committer | gitlabhq <m@gitlabhq.com> | 2011-10-10 00:15:28 +0300 |
| commit | ec9e54ea9496ed98b6400b479f50e19b89f3dcb4 (patch) | |
| tree | 2acaf52c7f2bf7a54b774ae10e0cf1bc500c52d1 /app/controllers | |
| parent | d7ea9052f1ecc5add24ad8b9d0cb06082f28c86f (diff) | |
| download | gitlab-ce-ec9e54ea9496ed98b6400b479f50e19b89f3dcb4.tar.gz | |
gitosis error handle
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/application_controller.rb | 4 | ||||
| -rw-r--r-- | app/controllers/errors_controller.rb | 5 | ||||
| -rw-r--r-- | app/controllers/projects_controller.rb | 2 |
3 files changed, 11 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 09c44502cdf..829126fee05 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb new file mode 100644 index 00000000000..c37f10a39f3 --- /dev/null +++ b/app/controllers/errors_controller.rb @@ -0,0 +1,5 @@ +class ErrorsController < ApplicationController + def gitosis + render :file => File.join(Rails.root, "public", "gitosis_error"), :layout => false + end +end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 3307ac23d9b..080a6ee62f6 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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| |
