Handle ReadTimeouts for LTI consumer properly
This commit is contained in:
@ -174,7 +174,7 @@ module Lti
|
|||||||
begin
|
begin
|
||||||
response = provider.post_replace_result!(normalized_lit_score)
|
response = provider.post_replace_result!(normalized_lit_score)
|
||||||
{code: response.response_code, message: response.post_response.body, status: response.code_major, score_sent: normalized_lit_score}
|
{code: response.response_code, message: response.post_response.body, status: response.code_major, score_sent: normalized_lit_score}
|
||||||
rescue IMS::LTI::XMLParseError
|
rescue IMS::LTI::XMLParseError, Net::OpenTimeout
|
||||||
# A parsing error might happen if the LTI provider is down and doesn't return a valid XML response
|
# A parsing error might happen if the LTI provider is down and doesn't return a valid XML response
|
||||||
{status: 'error'}
|
{status: 'error'}
|
||||||
end
|
end
|
||||||
|
@ -589,7 +589,7 @@ class ExercisesController < ApplicationController
|
|||||||
redirect_after_submit
|
redirect_after_submit
|
||||||
else
|
else
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to(implement_exercise_path(@submission.exercise)) }
|
format.html { redirect_to(implement_exercise_path(@submission.exercise, alert: I18n.t('exercises.submit.failure'))) }
|
||||||
format.json { render(json: {message: I18n.t('exercises.submit.failure')}, status: :service_unavailable) }
|
format.json { render(json: {message: I18n.t('exercises.submit.failure')}, status: :service_unavailable) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user