tool-exception.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef AFUN_TOOL_EXCEPTION_H
  2. #define AFUN_TOOL_EXCEPTION_H
  3. #include "aFunToolExport.h"
  4. #include "macro.h"
  5. #include "tool-type.h"
  6. namespace aFuntool {
  7. class AFUN_TOOL_EXPORT aFunException : public std::exception {
  8. std::string message;
  9. public:
  10. AFUN_INLINE explicit aFunException(std::string msg);
  11. virtual const char *what();
  12. [[nodiscard]] AFUN_INLINE const std::string &getMessage() const;
  13. };
  14. class aFuntoolException : public aFunException {
  15. public:
  16. AFUN_INLINE explicit aFuntoolException(const std::string &msg);
  17. };
  18. class FileOpenException : public aFuntoolException {
  19. public:
  20. AFUN_INLINE explicit FileOpenException(const FilePath &file);
  21. };
  22. class RegexException : public aFuntoolException {
  23. public:
  24. AFUN_INLINE explicit RegexException(const std::string &msg);
  25. };
  26. class LogFatalError : public aFuntoolException {
  27. public:
  28. AFUN_INLINE explicit LogFatalError(const char *msg);
  29. };
  30. class Exit : public aFuntoolException {
  31. int exit_code;
  32. public:
  33. AFUN_INLINE explicit Exit(int exit_code_);
  34. AFUN_INLINE int getExitCode() const;
  35. };
  36. }
  37. #include "tool-exception.inline.h"
  38. #endif //AFUN_TOOL_EXCEPTION_H