ctkPluginException.h

Go to the documentation of this file.
00001 /*=============================================================================
00002 
00003   Library: CTK
00004 
00005   Copyright (c) 2010 German Cancer Research Center,
00006     Division of Medical and Biological Informatics
00007 
00008   Licensed under the Apache License, Version 2.0 (the "License");
00009   you may not use this file except in compliance with the License.
00010   You may obtain a copy of the License at
00011 
00012     http://www.apache.org/licenses/LICENSE-2.0
00013 
00014   Unless required by applicable law or agreed to in writing, software
00015   distributed under the License is distributed on an "AS IS" BASIS,
00016   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00017   See the License for the specific language governing permissions and
00018   limitations under the License.
00019 
00020 =============================================================================*/
00021 
00022 #ifndef CTKPLUGINEXCEPTION_H
00023 #define CTKPLUGINEXCEPTION_H
00024 
00025 #include <stdexcept>
00026 
00027 #include <QString>
00028 #include <QDebug>
00029 
00030 #include "CTKPluginFrameworkExport.h"
00031 
00032 
00033 class CTK_PLUGINFW_EXPORT ctkPluginException : public std::runtime_error
00034 {
00035 public:
00036 
00037   enum Type {
00041     UNSPECIFIED,
00045     UNSUPPORTED_OPERATION,
00049     INVALID_OPERATION,
00053     MANIFEST_ERROR,
00057     RESOLVE_ERROR,
00061     ACTIVATOR_ERROR,
00065     SECURITY_ERROR,
00069     STATECHANGE_ERROR,
00074     DUPLICATE_BUNDLE_ERROR
00075   };
00076 
00077   ctkPluginException(const QString& msg, const Type& type = UNSPECIFIED, const std::exception& cause = std::exception());
00078   ctkPluginException(const QString& msg, const std::exception& cause);
00079 
00080   ctkPluginException(const ctkPluginException& o);
00081   ctkPluginException& operator=(const ctkPluginException& o);
00082 
00083   ~ctkPluginException() throw() {}
00084 
00085   std::exception getCause() const;
00086   void setCause(const std::exception&) throw(std::logic_error);
00087   Type getType() const;
00088 
00089   const char* what() const throw();
00090 
00091 
00092 private:
00093 
00094   Type type;
00095   std::exception cause;
00096 
00097 };
00098 
00099 
00100 CTK_PLUGINFW_EXPORT QDebug operator<<(QDebug dbg, const ctkPluginException& exc);
00101 
00102 #endif // CTKPLUGINEXCEPTION_H
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines