mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
Implementa Exception
This commit is contained in:
parent
8007a41690
commit
b442c158b7
@ -2,6 +2,7 @@
|
||||
# and include sub-projects here.
|
||||
#
|
||||
cmake_minimum_required (VERSION 3.8)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
# Enable Hot Reload for MSVC compilers if supported.
|
||||
if (POLICY CMP0141)
|
||||
|
37
inc/xna/exception.hpp
Normal file
37
inc/xna/exception.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef XNA_EXCEPTION_HPP
|
||||
#define XNA_EXCEPTION_HPP
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <source_location>
|
||||
|
||||
namespace xna {
|
||||
struct ExMessage {
|
||||
inline static const std::string InitializeComponent = "Unable to initialize component";
|
||||
};
|
||||
|
||||
struct Exception {
|
||||
static void Throw(std::string const& message, const std::source_location location = std::source_location::current()) {
|
||||
std::string error;
|
||||
error.append("Exception in: ");
|
||||
|
||||
#if _DEBUG
|
||||
error.append(location.file_name());
|
||||
error.append("(");
|
||||
error.append(std::to_string(location.line()));
|
||||
error.append(":");
|
||||
error.append(std::to_string(location.column()));
|
||||
error.append(") ");
|
||||
#endif
|
||||
error.append("'");
|
||||
error.append(location.function_name());
|
||||
error.append("': ");
|
||||
error.append(message);
|
||||
error.append("\n");
|
||||
|
||||
throw std::runtime_error(error);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -59,6 +59,7 @@ using comptr = Microsoft::WRL::ComPtr<T>;
|
||||
// OTHERS INCLUDES
|
||||
//--------------------------------//
|
||||
|
||||
#include "../exception.hpp"
|
||||
#include "../graphics/blendstate.hpp"
|
||||
#include "../graphics/adapter.hpp"
|
||||
#include "../graphics/device.hpp"
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "types.hpp"
|
||||
#include "helpers.hpp"
|
||||
#include "enums.hpp"
|
||||
#include "exception.hpp"
|
||||
#include "audio/audioengine.hpp"
|
||||
#include "audio/soundeffect.hpp"
|
||||
#include "common/color.hpp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user