diff --git a/app/controllers/concerns/lti.rb b/app/controllers/concerns/lti.rb index 0592b3da..30fb692e 100644 --- a/app/controllers/concerns/lti.rb +++ b/app/controllers/concerns/lti.rb @@ -170,8 +170,14 @@ module Lti # Reduce score by 100% normalized_lit_score *= 0.0 end - 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} + + begin + 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} + rescue IMS::LTI::XMLParseError + # A parsing error might happen if the LTI provider is down and doesn't return a valid XML response + {status: 'error'} + end else {status: 'unsupported'} end