This commit is contained in:
16
include/errors/errors.hpp
Normal file
16
include/errors/errors.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace kuiper
|
||||
{
|
||||
|
||||
enum class error : std::uint8_t {
|
||||
unknown,
|
||||
failed_to_load,
|
||||
resource_missing,
|
||||
resource_invalid,
|
||||
opengl_error
|
||||
};
|
||||
|
||||
} // namespace kuiper
|
||||
30
include/errors/exceptions.hpp
Normal file
30
include/errors/exceptions.hpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <exception>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
namespace kuiper
|
||||
{
|
||||
namespace exceptions
|
||||
{
|
||||
class file_not_found : public std::exception {
|
||||
public:
|
||||
file_not_found(const std::filesystem::path& path)
|
||||
: m_path(path) {};
|
||||
|
||||
public:
|
||||
inline std::filesystem::path path() const noexcept {
|
||||
return m_path;
|
||||
}
|
||||
|
||||
// Implementing std::exception
|
||||
inline const char* what() const noexcept override {
|
||||
return "file not found";
|
||||
}
|
||||
|
||||
private:
|
||||
std::filesystem::path m_path;
|
||||
};
|
||||
} // namespace exceptions
|
||||
} // namespace kuiper
|
||||
Reference in New Issue
Block a user