ctkCmdLineModuleRunException.cpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #include "ctkCmdLineModuleRunException.h"
  16. #include <QUrl>
  17. //----------------------------------------------------------------------------
  18. ctkCmdLineModuleRunException::ctkCmdLineModuleRunException(const QUrl &location, int errorCode, const QString &errorString)
  19. : QtConcurrent::Exception(),
  20. ctkException(QString("Running module \"%1\" failed with code %2: %3").arg(location.toString()).arg(errorCode).arg(errorString)),
  21. Location(location), ErrorCode(errorCode), ErrorString(errorString)
  22. {
  23. }
  24. //----------------------------------------------------------------------------
  25. ctkCmdLineModuleRunException::ctkCmdLineModuleRunException(const QUrl &location, int errorCode, const QString &errorString,
  26. const ctkCmdLineModuleRunException& cause)
  27. : QtConcurrent::Exception(), ctkException(location.toString(), cause),
  28. Location(location), ErrorCode(errorCode), ErrorString(errorString)
  29. {
  30. }
  31. //----------------------------------------------------------------------------
  32. ctkCmdLineModuleRunException::ctkCmdLineModuleRunException(const ctkCmdLineModuleRunException& o)
  33. : QtConcurrent::Exception(o), ctkException(o),
  34. Location(o.Location), ErrorCode(o.ErrorCode), ErrorString(o.ErrorString)
  35. {
  36. }
  37. //----------------------------------------------------------------------------
  38. ctkCmdLineModuleRunException& ctkCmdLineModuleRunException::operator=(const ctkCmdLineModuleRunException& o)
  39. {
  40. QtConcurrent::Exception::operator=(o);
  41. ctkException::operator=(o);
  42. this->Location = o.Location;
  43. this->ErrorCode = o.ErrorCode;
  44. this->ErrorString = o.ErrorString;
  45. return *this;
  46. }
  47. //----------------------------------------------------------------------------
  48. ctkCmdLineModuleRunException::~ctkCmdLineModuleRunException() throw()
  49. {
  50. }
  51. //----------------------------------------------------------------------------
  52. QUrl ctkCmdLineModuleRunException::location() const throw()
  53. {
  54. return Location;
  55. }
  56. //----------------------------------------------------------------------------
  57. int ctkCmdLineModuleRunException::errorCode() const throw()
  58. {
  59. return ErrorCode;
  60. }
  61. //----------------------------------------------------------------------------
  62. QString ctkCmdLineModuleRunException::errorString() const throw()
  63. {
  64. return ErrorString;
  65. }
  66. //----------------------------------------------------------------------------
  67. const char* ctkCmdLineModuleRunException::name() const throw()
  68. {
  69. return "CTK CommandLineModule Run Exception";
  70. }
  71. //----------------------------------------------------------------------------
  72. const char* ctkCmdLineModuleRunException::className() const throw()
  73. {
  74. return "ctkCmdLineModuleRunException";
  75. }
  76. //----------------------------------------------------------------------------
  77. ctkCmdLineModuleRunException* ctkCmdLineModuleRunException::clone() const
  78. {
  79. return new ctkCmdLineModuleRunException(*this);
  80. }
  81. //----------------------------------------------------------------------------
  82. void ctkCmdLineModuleRunException::rethrow() const
  83. {
  84. throw *this;
  85. }
  86. //----------------------------------------------------------------------------
  87. void ctkCmdLineModuleRunException::raise() const
  88. {
  89. throw *this;
  90. }