DynamicLibraryManagerException.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef CPPUNIT_PLUGIN_DYNAMICLIBRARYMANAGEREXCEPTION_H
  2. #define CPPUNIT_PLUGIN_DYNAMICLIBRARYMANAGEREXCEPTION_H
  3. #include <cppunit/Portability.h>
  4. #if !defined(CPPUNIT_NO_TESTPLUGIN)
  5. #include <stdexcept>
  6. #include <string>
  7. CPPUNIT_NS_BEGIN
  8. /*! \brief Exception thrown by DynamicLibraryManager when a failure occurs.
  9. *
  10. * Use getCause() to know what function caused the failure.
  11. *
  12. */
  13. class DynamicLibraryManagerException : public std::runtime_error
  14. {
  15. public:
  16. enum Cause
  17. {
  18. /// Failed to load the dynamic library
  19. loadingFailed =0,
  20. /// Symbol not found in the dynamic library
  21. symbolNotFound
  22. };
  23. /// Failed to load the dynamic library or Symbol not found in the dynamic library.
  24. DynamicLibraryManagerException( const std::string &libraryName,
  25. const std::string &errorDetail,
  26. Cause cause );
  27. ~DynamicLibraryManagerException() throw()
  28. {
  29. }
  30. Cause getCause() const;
  31. const char *what() const throw();
  32. private:
  33. std::string m_message;
  34. Cause m_cause;
  35. };
  36. CPPUNIT_NS_END
  37. #endif // !defined(CPPUNIT_NO_TESTPLUGIN)
  38. #endif // CPPUNIT_PLUGIN_DYNAMICLIBRARYMANAGEREXCEPTION_H