Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
usServiceException.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 
14 #ifndef USSERVICEEXCEPTION_H
15 #define USSERVICEEXCEPTION_H
16 
17 #include <stdexcept>
18 
19 #include <usGlobalConfig.h>
21 
22 namespace us {
23 
37 class MITKCPPMICROSERVICES_EXPORT ServiceException : public std::runtime_error
38 {
39 public:
40 
41  enum Type {
45  UNSPECIFIED = 0,
49  UNREGISTERED = 1,
53  FACTORY_ERROR = 2,
57  FACTORY_EXCEPTION = 3,
61  REMOTE = 5,
66  FACTORY_RECURSION = 6
67  };
68 
76  ServiceException(const std::string& msg, const Type& type = UNSPECIFIED);
77 
80 
83 
84  ~ServiceException() throw() override { }
85 
92  Type GetType() const;
93 
94 private:
95 
99  Type type;
100 
101 };
102 
103 }
104 
111 MITKCPPMICROSERVICES_EXPORT std::ostream& operator<<(std::ostream& os, const us::ServiceException& exc);
114 #endif // USSERVICEEXCEPTION_H
#define MITKCPPMICROSERVICES_EXPORT
Type GetType() const
Returns the type for this exception or UNSPECIFIED if the type was unspecified or unknown.
ServiceException & operator=(const ServiceException &o)
Copy assignment operator.
ServiceException(const std::string &msg, const Type &type=UNSPECIFIED)
Creates a ServiceException with the specified message, type and exception cause.
ServiceException(const ServiceException &o)
Copy constructor.
MITKCPPMICROSERVICES_EXPORT std::ostream & operator<<(std::ostream &os, const us::ServiceException &exc)
Stream output operator for ServiceException.