Skip to content

Commit

Permalink
Nicer error handling/messaging - spectrum and slice viewers, re #8091
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeMPouzols committed Oct 27, 2014
1 parent 9be889d commit 56d6693
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp
Expand Up @@ -751,11 +751,15 @@ void MantidUI::showSpectrumViewer()
AnalysisDataService::Instance().retrieve( wsName.toStdString()) );
if ( wksp )
{
MantidQt::SpectrumView::SpectrumView* viewer = new MantidQt::SpectrumView::SpectrumView(m_appWindow);
if(!viewer)
try
{
MantidQt::SpectrumView::SpectrumView* viewer = new MantidQt::SpectrumView::SpectrumView(m_appWindow);
}
catch (std::runtime_erro& e)
{
m_lastShownSpectrumViewerWin = NULL;
return;
g_log.error() << "Could not create spectrum viewer: " << e.what << "\n";
throw std::runtime_error(e);
}
viewer->setAttribute(Qt::WA_DeleteOnClose, false);
viewer->resize( 1050, 800 );
Expand Down Expand Up @@ -812,13 +816,16 @@ void MantidUI::showSliceViewer()
if (mdws)
{
// Create the slice viewer window
SliceViewerWindow * w = MantidQt::Factory::WidgetFactory::Instance()->
createSliceViewerWindow(wsName, "");

if(!w)
try
{
SliceViewerWindow * w = MantidQt::Factory::WidgetFactory::Instance()->
createSliceViewerWindow(wsName, "");
}
catch (std::runtime_error& e)
{
m_lastShownSliceViewWin = NULL;
return;
g_log.error() << "Could not create slice viewer: " << e.what << "\n";
throw std::runtime_error(e);
}

// Special options for viewing MatrixWorkspaces
Expand Down

0 comments on commit 56d6693

Please sign in to comment.