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

Fixed unhandled exception when plotting a live event histogram #36775

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -383,7 +383,13 @@ def _action_double_click_workspace(self, name):
plot_kwargs = {"axis": MantidAxType.BIN}
plot([ws], errors=False, overplot=False, wksp_indices=[0], plot_kwargs=plot_kwargs)
else:
plot_from_names([name], errors=False, overplot=False, show_colorfill_btn=True)
try:
plot_from_names([name], errors=False, overplot=False, show_colorfill_btn=True)
except RuntimeError as err:
if "Variable invalidated" in str(err):
logger.error(str(err))
else:
raise err
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I opted to only cover the plot_fom_names function inside the try block.

  • Should the try block be bigger?

Then I have an if/else statement to check that the RunTime error caught is specifically the one relating to the deleted data.

  • Should I use a regular expression in this if statement instead?
  • If in the future the message for this runtime error changes, then the if statement will always yield false, is there any way to prevent this?


def refresh_workspaces(self):
self.workspacewidget.refreshWorkspaces()
Expand Down