-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: [AXIMST-490] display render errors #2506
Conversation
bae60ac
to
22a3bce
Compare
22a3bce
to
e343bbd
Compare
cms/djangoapps/contentstore/utils.py
Outdated
return validation_json['messages'] | ||
|
||
|
||
def get_render_error(request, xblock): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can call it get_xblock_render_error
and the function that is inside will be called get_xblock_render_error_context
.
This will allow to put the inner function outside and clarify the idea behind these two functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we need to move out this function, it will be used only here.
Renamed
cms/djangoapps/contentstore/utils.py
Outdated
render_error = "" | ||
try: | ||
block = _load_preview_block(request, xblock) | ||
preview_view = AUTHOR_VIEW if has_author_view(block) else STUDENT_VIEW | ||
render_context = get_render_context(request, block) | ||
block.render(preview_view, render_context) | ||
except Exception as exc: # pylint: disable=broad-except | ||
render_error = str(exc) | ||
|
||
return render_error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
render_error = "" | |
try: | |
block = _load_preview_block(request, xblock) | |
preview_view = AUTHOR_VIEW if has_author_view(block) else STUDENT_VIEW | |
render_context = get_render_context(request, block) | |
block.render(preview_view, render_context) | |
except Exception as exc: # pylint: disable=broad-except | |
render_error = str(exc) | |
return render_error | |
try: | |
block = _load_preview_block(request, xblock) | |
preview_view = AUTHOR_VIEW if has_author_view(block) else STUDENT_VIEW | |
render_context = get_render_context(request, block) | |
block.render(preview_view, render_context) | |
except Exception as exc: # pylint: disable=broad-except | |
return str(exc) | |
return "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, thanks!
* feat: [AXIMST-490] display render errors * fix: resolve discussions
* feat: [AXIMST-490] display render errors * fix: resolve discussions
* feat: [AXIMST-490] display render errors * fix: resolve discussions
AXIMST-490