FileOperationException.hpp 778 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-15
  6. * Changed: 2020-08-15
  7. *
  8. * */
  9. #ifndef FILE_OPERATION_EXCEPTION_HPP
  10. #define FILE_OPERATION_EXCEPTION_HPP
  11. #include <exception>
  12. #include <string>
  13. namespace ls_std {
  14. class FileOperationException : public std::exception {
  15. public:
  16. explicit FileOperationException(std::string _filePath):
  17. filePath(std::move(_filePath))
  18. {}
  19. const char *what() const noexcept override {
  20. const std::string errorMessage = "file operation failed!\nfile: " + this->filePath;
  21. return std::move(errorMessage.c_str());
  22. }
  23. private:
  24. std::string filePath {};
  25. };
  26. }
  27. #endif