ctkPluginException.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef CTKPLUGINEXCEPTION_H
  2. #define CTKPLUGINEXCEPTION_H
  3. #include <stdexcept>
  4. #include <QString>
  5. #include <QDebug>
  6. namespace ctk {
  7. class PluginException : public std::runtime_error
  8. {
  9. public:
  10. enum Type {
  11. /**
  12. * No exception type is unspecified.
  13. */
  14. UNSPECIFIED,
  15. /**
  16. * The operation was unsupported.
  17. */
  18. UNSUPPORTED_OPERATION,
  19. /**
  20. * The operation was invalid.
  21. */
  22. INVALID_OPERATION,
  23. /**
  24. * The bundle manifest contains errors.
  25. */
  26. MANIFEST_ERROR,
  27. /**
  28. * The bundle was not resolved.
  29. */
  30. RESOLVE_ERROR,
  31. /**
  32. * The bundle activator was in error.
  33. */
  34. ACTIVATOR_ERROR,
  35. /**
  36. * The operation failed due to insufficient permissions.
  37. */
  38. SECURITY_ERROR,
  39. /**
  40. * The operation failed to complete the requested lifecycle state change.
  41. */
  42. STATECHANGE_ERROR,
  43. /**
  44. * The install or update operation failed because another
  45. * already installed bundle has the same symbolic name and version.
  46. */
  47. DUPLICATE_BUNDLE_ERROR
  48. };
  49. PluginException(const QString& msg, const Type& type = UNSPECIFIED, const std::exception& cause = std::exception());
  50. PluginException(const QString& msg, const std::exception& cause);
  51. PluginException(const PluginException& o);
  52. PluginException& operator=(const PluginException& o);
  53. ~PluginException() throw() {}
  54. std::exception getCause() const;
  55. void setCause(const std::exception&) throw(std::logic_error);
  56. Type getType() const;
  57. const char* what() const throw();
  58. private:
  59. const QString msg;
  60. const Type type;
  61. std::exception cause;
  62. };
  63. }
  64. QDebug operator<<(QDebug dbg, const ctk::PluginException& exc);
  65. #endif // CTKPLUGINEXCEPTION_H