add some rescue

This commit is contained in:
BOHUNG 2019-09-29 16:13:18 +08:00
parent c47f65def8
commit c3e52b08df
2 changed files with 5 additions and 4 deletions

View File

@ -127,8 +127,9 @@ class Admin::PatchfilesController < OrbitAdminController
end
end
def getfont
@font_array = []
@ckeditor_path = ENV['PWD'] + '/app/assets/javascripts/ckeditor'
@filedata = File.read(@ckeditor_path+"/config.js.erb")
@filedata = File.read(@ckeditor_path+"/config.js.erb") rescue return
@name_to_search ="config.font_names"
@index_of_font = @filedata.index(@name_to_search)
@font_str = ""

View File

@ -32,7 +32,7 @@ class Patchfilefield
end
def get_font_to_store
@ckeditor_path = ENV['PWD'] + '/app/assets/javascripts/ckeditor'
@filedata = File.read(@ckeditor_path+"/config.js.erb")
@filedata = File.read(@ckeditor_path+"/config.js.erb") rescue return
@name_to_search ="config.font_names"
@index_of_font = @filedata.index(@name_to_search)
@font_str = ""
@ -119,7 +119,7 @@ class Patchfilefield
end
def check_font_state
@ckeditor_path = ENV['PWD'] + '/app/assets/javascripts/ckeditor'
@filedata = File.read(@ckeditor_path+"/config.js.erb")
@filedata = File.read(@ckeditor_path+"/config.js.erb") rescue return
@name_to_search ="config.font_names"
@index_of_font = @filedata.index(@name_to_search)
@font_str = ""
@ -221,7 +221,7 @@ class Patchfilefield
puts @filedata
@filetowrite.write(@filedata)
@filetowrite.close
@filetocover = File.open("config.js.erb","w")
@filetocover = File.open("config.js.erb","w") rescue return
@filetocover.write(@filedata)
@filetocover.close
File.delete("config_back.js.erb")