Rescue URI Error

This commit is contained in:
Bernie Chiu 2013-09-17 16:37:38 +08:00
parent 21009961ef
commit 1305b9f1ef
1 changed files with 7 additions and 1 deletions

View File

@ -29,8 +29,13 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
end
params[:school][:depts].each do |dns|
begin
send_request(dns, @ask_question, @ask_reply)
rescue URI::InvalidURIError
next
end
end unless params[:school].nil?
redirect_to panel_ask_back_end_ask_questions_path, notice: t('ask.reply_success')
end
@ -59,6 +64,7 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
response = http.request(request)
# binding.pry
if response.code != "200"
# Think about another rescue method.
new_status = "轉介其他單位"
current_reply.update_attributes(status: new_status)
else