-
Notifications
You must be signed in to change notification settings - Fork 92
/
RaylibException.hpp
36 lines (29 loc) · 940 Bytes
/
RaylibException.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef RAYLIB_CPP_INCLUDE_RAYLIBEXCEPTION_HPP_
#define RAYLIB_CPP_INCLUDE_RAYLIBEXCEPTION_HPP_
#include <stdexcept>
#include <string>
#include "./raylib.hpp"
namespace raylib {
/**
* Exception used for most raylib-related exceptions.
*/
class RaylibException : public std::runtime_error {
public:
/**
* Construct a runtime exception with the given message.
*
* @param message The message to provide for the exception.
*/
explicit RaylibException(const std::string& message) noexcept : std::runtime_error(message) {
// Nothing
}
/**
* Outputs the exception message to TraceLog().
*
* @param logLevel The output status to use when outputing.
*/
void TraceLog(int logLevel = LOG_ERROR) { ::TraceLog(logLevel, std::runtime_error::what()); }
};
} // namespace raylib
using RRaylibException = raylib::RaylibException;
#endif // RAYLIB_CPP_INCLUDE_RAYLIBEXCEPTION_HPP_