try to catch a MentosError error

This commit is contained in:
Alexander Machehin 2014-10-07 22:38:52 +06:00
parent d11fe17937
commit dbb1d19ac0
4 changed files with 8 additions and 3 deletions

View File

@ -40,7 +40,7 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
def log
render json: {
log: Pygments.highlight(@product_build_list.abf_worker_log, lexer: 'sh'),
log: ( Pygments.highlight(@product_build_list.abf_worker_log, lexer: 'sh') rescue I18n.t('layout.build_lists.log.not_available')),
building: @product_build_list.build_started?
}
end

View File

@ -17,7 +17,7 @@ class Projects::Git::TreesController < Projects::Git::BaseController
def archive
format, @treeish = params[:format], params[:treeish]
raise Grit::NoSuchPathError unless @treeish =~ /^#{@project.name}-/ &&
raise Grit::NoSuchPathError unless @treeish =~ /^#{@project.name}-/ &&
@treeish !~ /[\s]+/ &&
format =~ /^(zip|tar\.gz)$/
@treeish.gsub!(/^#{@project.name}-/, '')

View File

@ -110,6 +110,8 @@ module GitHelper
else
blob.colorize
end.html_safe
rescue MentosError => e
blob.data.html_safe
end
def blame_highlight(blob, text)
@ -118,5 +120,7 @@ module GitHelper
else
blob.lexer.highlight text
end.html_safe
rescue MentosError => e
text.html_safe
end
end

View File

@ -505,7 +505,8 @@ class BuildList < ActiveRecord::Base
def log(load_lines)
if new_core?
Pygments.highlight abf_worker_log, lexer: 'sh'
worker_log = abf_worker_log
Pygments.highlight(worker_log, lexer: 'sh') rescue worker_log
else
I18n.t('layout.build_lists.log.not_available')
end