# HG changeset patch # User Sebastien Jodogne # Date 1570710542 -7200 # Node ID 348866dd217c332ac8009f3c8cee62c26e695cb8 # Parent f6be9412e42a09d2fe7920f44dd9cec7b081a3d3 removing classes OpenGLContextLostException and StoneOrthancException diff -r f6be9412e42a -r 348866dd217c Applications/Samples/CMakeLists.txt --- 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 diff -r f6be9412e42a -r 348866dd217c Framework/Scene2DViewport/ViewportController.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 > ViewportController::HitTestMeasureTools( diff -r f6be9412e42a -r 348866dd217c Framework/StoneException.h --- 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(applicationErrorCode_); - - return errorMessage_.c_str(); - } - }; } // See https://isocpp.org/wiki/faq/misc-technical-issues#macros-with-multi-stmts @@ -165,14 +97,6 @@ - - - - - - - - /* Explanation: diff -r f6be9412e42a -r 348866dd217c UnitTestsSources/TestExceptions.cpp --- 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 . - **/ - - -#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); -}