Rescue URI Error
This commit is contained in:
1 parent
21009961ef
commit
1305b9f1ef
1 file changed
+7
-1
Vendored
+7
-1
@@ -29,8 +29,13 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
|
||||
end
|
||||
|
||||
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?
|
||||
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user