Skip to content

Commit

Permalink
feat: add ability to render a custom error message from filter
Browse files Browse the repository at this point in the history
  • Loading branch information
nsprenkle committed Jun 21, 2024
1 parent 7d95eef commit 9df657f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lms/djangoapps/courseware/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1672,8 +1672,14 @@ def render_xblock(request, usage_key_string, check_if_enrolled=True, disable_sta
context=context, student_view_context=student_view_context
)
except RenderXBlockStarted.PreventXBlockBlockRender as exc:
log.info("Skipping rendering block %s. Reason: %s", usage_key_string, exc.message)
log.info("Halted rendering block %s. Reason: %s", usage_key_string, exc.message)
return render_500()
except RenderXBlockStarted.RenderCustomResponse as exc:
log.info("Rendering custom exception for block %s. Reason: %s", usage_key_string, exc.message)
context.update({
'fragment': Fragment(exc.response)
})
return render_to_response('courseware/courseware-chromeless.html', context, request=request)

fragment = block.render(requested_view, context=student_view_context)
optimization_flags = get_optimization_flags_for_content(block, fragment)
Expand Down

0 comments on commit 9df657f

Please sign in to comment.