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