diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-01-23 17:25:11 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-01-23 17:25:11 +0000 |
commit | 91dc13f4b22c45bee5cfd1d783d6544ae79afa04 (patch) | |
tree | b57967d4dcb3afbf1fdcb1d6ee4c8bf58e7cf41c /app | |
parent | 97e7432ce6da80dea633cd99e934943925a774b5 (diff) | |
download | redmine-91dc13f4b22c45bee5cfd1d783d6544ae79afa04.tar.gz redmine-91dc13f4b22c45bee5cfd1d783d6544ae79afa04.zip |
Show explicit error message when the scm command failed (eg. when svn binary is not available).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1094 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/application.rb | 5 | ||||
-rw-r--r-- | app/controllers/repositories_controller.rb | 23 |
2 files changed, 25 insertions, 3 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 66cec7d2a..f4883cf52 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -137,6 +137,11 @@ class ApplicationController < ActionController::Base return false end + def render_error(msg) + flash.now[:error] = msg + render :nothing => true, :layout => !request.xhr?, :status => 500 + end + def render_feed(items, options={}) @items = items || [] @items.sort! {|x,y| y.event_datetime <=> x.event_datetime } diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 6c2b088cc..542eb93ea 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -56,6 +56,8 @@ class RepositoriesController < ApplicationController # latest changesets @changesets = @repository.changesets.find(:all, :limit => 10, :order => "committed_on DESC") show_error and return unless @entries || @changesets.any? + rescue Redmine::Scm::Adapters::CommandFailed => e + show_error_command_failed(e.message) end def browse @@ -65,12 +67,16 @@ class RepositoriesController < ApplicationController else show_error unless @entries end + rescue Redmine::Scm::Adapters::CommandFailed => e + show_error_command_failed(e.message) end def changes @entry = @repository.scm.entry(@path, @rev) show_error and return unless @entry @changesets = @repository.changesets_for_path(@path) + rescue Redmine::Scm::Adapters::CommandFailed => e + show_error_command_failed(e.message) end def revisions @@ -97,11 +103,15 @@ class RepositoriesController < ApplicationController # Prevent empty lines when displaying a file with Windows style eol @content.gsub!("\r\n", "\n") end + rescue Redmine::Scm::Adapters::CommandFailed => e + show_error_command_failed(e.message) end def annotate @annotate = @repository.scm.annotate(@path, @rev) show_error and return if @annotate.nil? || @annotate.empty? + rescue Redmine::Scm::Adapters::CommandFailed => e + show_error_command_failed(e.message) end def revision @@ -119,6 +129,8 @@ class RepositoriesController < ApplicationController end rescue ChangesetNotFound show_error + rescue Redmine::Scm::Adapters::CommandFailed => e + show_error_command_failed(e.message) end def diff @@ -137,6 +149,8 @@ class RepositoriesController < ApplicationController @diff = @repository.diff(@path, @rev, @rev_to, @diff_type) show_error and return unless @diff end + rescue Redmine::Scm::Adapters::CommandFailed => e + show_error_command_failed(e.message) end def stats @@ -176,9 +190,12 @@ private render_404 end - def show_error - flash.now[:error] = l(:notice_scm_error) - render :nothing => true, :layout => true + def show_error_not_found + render_error l(:error_scm_not_found) + end + + def show_error_command_failed(msg) + render_error l(:error_scm_command_failed, msg) end def graph_commits_per_month(repository) |