Skip to content
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

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

ruzniaievdm
Copy link

@ruzniaievdm ruzniaievdm force-pushed the ruzniaievdm/feat/display-render-errors branch 3 times, most recently from bae60ac to 22a3bce Compare February 15, 2024 09:16
@ruzniaievdm ruzniaievdm self-assigned this Feb 15, 2024
@ruzniaievdm ruzniaievdm force-pushed the ruzniaievdm/feat/display-render-errors branch from 22a3bce to e343bbd Compare February 15, 2024 10:39
@ruzniaievdm ruzniaievdm marked this pull request as ready for review February 15, 2024 12:57
return validation_json['messages']


def get_render_error(request, xblock):
Copy link

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.

Copy link
Author

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

Comment on lines 2190 to 2199
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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 ""

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, thanks!

@monteri monteri merged this pull request into ts-develop Feb 15, 2024
43 checks passed
ruzniaievdm added a commit that referenced this pull request Feb 22, 2024
* feat: [AXIMST-490] display render errors

* fix: resolve discussions
ruzniaievdm added a commit that referenced this pull request Mar 28, 2024
* feat: [AXIMST-490] display render errors

* fix: resolve discussions
ruzniaievdm added a commit that referenced this pull request Apr 4, 2024
* feat: [AXIMST-490] display render errors

* fix: resolve discussions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants