Topaz 5.0
Topaz Game Engine
Loading...
Searching...
No Matches
error.hpp
1#ifndef TOPAZ_CORE_ERROR_HPP
2#define TOPAZ_CORE_ERROR_HPP
3#include <string_view>
4#include <string>
5#include <array>
6
7namespace tz
8{
39
40 namespace detail
41 {
42 constexpr std::array<const char*, static_cast<int>(error_code::_count)> error_code_strings
43 {
44 "success",
45 "partial success",
46 "precondition failure error",
47 "invalid value error",
48 "machine unsuitability error",
49 "engine bug error",
50 "driver hazard error",
51 "unknown error",
52 "out of CPU memory error",
53 "out of GPU memory error",
54 "concurrent usage error"
55 };
56 }
57
58 constexpr const char* error_code_name(error_code ec)
59 {
60 return detail::error_code_strings[static_cast<int>(ec)];
61 }
62
63 std::string_view last_error();
64 void set_last_error(std::string errmsg);
65
66}
67
68#endif // TOPAZ_CORE_ERROR_HPP
error_code
Error codes for Topaz.
Definition error.hpp:14
@ machine_unsuitable
An error has occurred because the currently running machine does not support the given operation.
@ invalid_value
An error has occurred because an illegal/incorrect value has been detected.
@ success
Correct behaviour has occurred. No need to do any sanity checking.
@ engine_bug
An error has occurred due to an engine-side logic error, and you should submit a bug report.
@ voom
An error has occurred due to lack of GPU memory.
@ unknown_error
An error has occurred, but it's not clear why.
@ driver_hazard
An error has occurred due to a serious hazard relating to the driver/hardware. This most likely means...
@ precondition_failure
An error has occurred because some previously-required setup has not been complete....
@ concurrent_usage
An error has occurred due to an operation being invalid while a given resource is in use by something...
@ oom
An error has occurred due to lack of CPU memory.
@ partial_success
Nothing erroneous happened, but the process did not complete fully or otherwise provide an ideal resu...