From 76f39e6d4dbc59512c9af9a8c5fc90be9fd72f71 Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 28 Jul 2005 13:40:46 +0000 Subject: [PATCH] To improve exception handling --- src/VISUGUI/VISU_msg_en.po | 2 +- src/VISUGUI/VisuGUI_Tools.cxx | 12 ++++++++---- src/VISU_I/VISU_ScalarMap_i.cc | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index 1f32ea26..627949ea 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -351,7 +351,7 @@ msgstr "Arrange Actors" msgid "VisuGUI::ERR_ERROR_IN_THE_FILE" msgstr "Error in the file" -msgid "VisuGUI::ERR_CANT_CREATE_ACTOR" +msgid "ERR_CANT_CREATE_ACTOR" msgstr "Can't create actor for this presentation" msgid "VisuGUI::ERR_ACTIVATE_VIEW3D" diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index daa94500..7e85c595 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -415,7 +415,6 @@ namespace VISU } } thePrs->RemoveFromStudy(); - //theModule->updateObjBrowser(); //update Object browser } void @@ -615,8 +614,14 @@ namespace VISU return aActor; if(SVTK_ViewWindow* aView = GetViewWindow(theModule)){ QApplication::setOverrideCursor( Qt::waitCursor ); - if(aActor = thePrs->CreateActor()){ - aView->AddActor(aActor); + try{ + if(aActor = thePrs->CreateActor()) + aView->AddActor(aActor); + }catch(std::exception& exc){ + SUIT_MessageBox::warn1(GetDesktop(theModule), + QObject::tr("WRN_VISU"), + QObject::tr("ERR_CANT_CREATE_ACTOR"), + QObject::tr("BUT_OK")); } QApplication::restoreOverrideCursor(); } @@ -957,7 +962,6 @@ namespace VISU } } } - //theModule->updateObjBrowser(); PlotContainer( theModule, pContainer, VISU::eDisplay ); } } diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 6964bef7..7f8fcf5c 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -478,9 +478,9 @@ VISU_Actor* VISU::ScalarMap_i::CreateActor(const Handle(SALOME_InteractiveObject anActor->SetBarVisibility(true); anActor->SetRepresentation(2); UpdateActor(anActor); - }catch(...) { + }catch(...){ anActor->Delete(); - throw std::runtime_error("CreateActor error"); + throw; } return anActor; } -- 2.39.2