tool-exception.inline.h 973 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef AFUN_TOOL_EXCEPTION_INLINE_H
  2. #define AFUN_TOOL_EXCEPTION_INLINE_H
  3. #include "tool-exception.h"
  4. namespace aFuntool {
  5. inline aFunException::aFunException(std::string msg) : message{std::move(msg)} {
  6. }
  7. inline const char *aFunException::what() {
  8. return message.c_str();
  9. }
  10. inline aFuntoolException::aFuntoolException(const std::string &msg) : aFunException{msg} {
  11. }
  12. inline FileOpenException::FileOpenException(const FilePath &file) : aFuntoolException("File cannot open: " + file) {
  13. }
  14. inline RegexException::RegexException(const std::string &msg) : aFuntoolException("Regex error: " + msg) {
  15. }
  16. inline LogFatalError::LogFatalError(const char *msg) : aFuntoolException(msg) {
  17. }
  18. inline Exit::Exit(int exit_code_) : aFuntoolException("Exit by user"), exit_code{exit_code_} {
  19. }
  20. inline int Exit::getExitCode() const {
  21. return exit_code;
  22. }
  23. }
  24. #endif //AFUN_TOOL_EXCEPTION_INLINE_H