tool-exception.h 1.2 KB

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