when a resource is not found, an exceptions is thrown

This commit is contained in:
arthur.jamet
2021-06-17 11:17:18 +02:00
parent 5a948bca46
commit 1f1379a5a5
11 changed files with 67 additions and 16 deletions
+5
View File
@@ -26,3 +26,8 @@ RAY::Exception::WrongInputError::WrongInputError(const std::string &what):
RayError(what)
{
}
RAY::Exception::ResourceNotFound::ResourceNotFound(const std::string &path):
RayError("\033[36m" + path + "\033[31m couldn't be loaded\033[0m")
{
}
+17
View File
@@ -76,6 +76,23 @@ namespace RAY::Exception {
//! @brief A default assignment operator
WrongInputError &operator=(const WrongInputError &) = default;
};
//! @brief exception used when a resource is not found
class ResourceNotFound: public RayError {
public:
//! @brief Create a new exception instance
//! @param path path of the un-loadable path
explicit ResourceNotFound(const std::string &path);
//! @brief A default destructor
~ResourceNotFound() override = default;
//! @brief An exception is copy constructable
ResourceNotFound(const ResourceNotFound &) = default;
//! @brief A default assignment operator
ResourceNotFound &operator=(const ResourceNotFound &) = default;
};
}
#endif /* !RAYERROR_HPP_ */