ctkServiceException.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 "ctkServiceException.h"
  16. #include <QDebug>
  17. //----------------------------------------------------------------------------
  18. ctkServiceException::ctkServiceException(const QString& msg, const Type& type)
  19. : ctkRuntimeException(msg),
  20. type(type)
  21. {
  22. }
  23. //----------------------------------------------------------------------------
  24. ctkServiceException::ctkServiceException(const QString& msg, const Type& type,
  25. const ctkException& cause)
  26. : ctkRuntimeException(msg, cause),
  27. type(type)
  28. {
  29. }
  30. //----------------------------------------------------------------------------
  31. ctkServiceException::ctkServiceException(const QString& msg, const ctkException& cause)
  32. : ctkRuntimeException(msg, cause),
  33. type(UNSPECIFIED)
  34. {
  35. }
  36. //----------------------------------------------------------------------------
  37. ctkServiceException::ctkServiceException(const ctkServiceException& o)
  38. : ctkRuntimeException(o), type(o.type)
  39. {
  40. }
  41. //----------------------------------------------------------------------------
  42. ctkServiceException& ctkServiceException::operator=(const ctkServiceException& o)
  43. {
  44. ctkRuntimeException::operator=(o);
  45. type = o.type;
  46. return *this;
  47. }
  48. //----------------------------------------------------------------------------
  49. ctkServiceException::~ctkServiceException() throw()
  50. {
  51. }
  52. //----------------------------------------------------------------------------
  53. const char* ctkServiceException::name() const throw()
  54. {
  55. return "ctkServiceException";
  56. }
  57. //----------------------------------------------------------------------------
  58. ctkServiceException* ctkServiceException::clone() const
  59. {
  60. return new ctkServiceException(*this);
  61. }
  62. //----------------------------------------------------------------------------
  63. void ctkServiceException::rethrow() const
  64. {
  65. throw *this;
  66. }
  67. //----------------------------------------------------------------------------
  68. ctkServiceException::Type ctkServiceException::getType() const
  69. {
  70. return type;
  71. }