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 def log
render json: { 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? building: @product_build_list.build_started?
} }
end end

View File

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

View File

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

View File

@ -505,7 +505,8 @@ class BuildList < ActiveRecord::Base
def log(load_lines) def log(load_lines)
if new_core? 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 else
I18n.t('layout.build_lists.log.not_available') I18n.t('layout.build_lists.log.not_available')
end end