Mercurial > hg > orthanc-stone
changeset 1049:348866dd217c
removing classes OpenGLContextLostException and StoneOrthancException
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 10 Oct 2019 14:29:02 +0200 |
parents | f6be9412e42a |
children | d393ad9cf68c |
files | Applications/Samples/CMakeLists.txt Framework/Scene2DViewport/ViewportController.cpp Framework/StoneException.h UnitTestsSources/TestExceptions.cpp |
diffstat | 4 files changed, 1 insertions(+), 121 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/Samples/CMakeLists.txt Thu Oct 10 14:11:52 2019 +0200 +++ b/Applications/Samples/CMakeLists.txt Thu Oct 10 14:29:02 2019 +0200 @@ -232,7 +232,6 @@ add_executable(UnitTests ${GOOGLE_TEST_SOURCES} ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestCommands.cpp - ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestExceptions.cpp ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestMessageBroker.cpp ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStrategy.cpp ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStructureSet.cpp
--- a/Framework/Scene2DViewport/ViewportController.cpp Thu Oct 10 14:11:52 2019 +0200 +++ b/Framework/Scene2DViewport/ViewportController.cpp Thu Oct 10 14:29:02 2019 +0200 @@ -113,7 +113,7 @@ bool ViewportController::HandlePointerEvent(PointerEvent e) { - throw StoneException(ErrorCode_NotImplemented); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); } std::vector<boost::shared_ptr<MeasureTool> > ViewportController::HitTestMeasureTools(
--- a/Framework/StoneException.h Thu Oct 10 14:11:52 2019 +0200 +++ b/Framework/StoneException.h Thu Oct 10 14:29:02 2019 +0200 @@ -46,7 +46,6 @@ }; - class StoneException { protected: @@ -70,73 +69,6 @@ return "TODO: EnumerationToString for StoneException"; } }; - - class OpenGLContextLostException : public StoneException - { - public: - explicit OpenGLContextLostException(void* context) - : StoneException(ErrorCode_WebGLContextLost) - , context_(context) - { - } - virtual const char* What() const - { - return "The OpenGL/WebGL context has been lost!"; - } - void* context_; - }; - - // TODO - Is this still necessary? - class StoneOrthancException : public StoneException - { - protected: - Orthanc::OrthancException& orthancException_; - - public: - explicit StoneOrthancException(Orthanc::OrthancException& orthancException) : - StoneException(ErrorCode_OrthancError), - orthancException_(orthancException) - { - } - - Orthanc::ErrorCode GetOrthancErrorCode() const - { - return orthancException_.GetErrorCode(); - } - - virtual const char* What() const - { - return orthancException_.What(); - } - }; - - // TODO - To be moved in "../Applications/" - class StoneApplicationException : public StoneException - { - protected: - int applicationErrorCode_; - mutable std::string errorMessage_; - - public: - explicit StoneApplicationException(int applicationErrorCode) : - StoneException(ErrorCode_ApplicationException), - applicationErrorCode_(applicationErrorCode) - { - } - - int GetApplicationErrorCode() const - { - return applicationErrorCode_; - } - - virtual const char* What() const - { - if (errorMessage_.size() == 0) - errorMessage_ = boost::lexical_cast<std::string>(applicationErrorCode_); - - return errorMessage_.c_str(); - } - }; } // See https://isocpp.org/wiki/faq/misc-technical-issues#macros-with-multi-stmts @@ -165,14 +97,6 @@ - - - - - - - - /* Explanation:
--- a/UnitTestsSources/TestExceptions.cpp Thu Oct 10 14:11:52 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/** - * Stone of Orthanc - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2019 Osimis S.A., Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - **/ - - -#include "gtest/gtest.h" - -#include "../Framework/StoneException.h" - - - -TEST(StoneExceptions, OrthancToStoneConversion) -{ - bool hasBeenCatched = false; - try { - throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); - } - catch (Orthanc::OrthancException& orthancException) - { - hasBeenCatched = true; - OrthancStone::StoneOrthancException stoneException(orthancException); - ASSERT_EQ(OrthancStone::ErrorCode_OrthancError, stoneException.GetErrorCode()); - ASSERT_EQ(Orthanc::ErrorCode_InternalError, stoneException.GetOrthancErrorCode()); - } - - ASSERT_TRUE(hasBeenCatched); -}