-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/*============================================================================= | ||
Copyright (C) 2015-2016 DxLibEx project | ||
https://github.com/Nagarei/DxLibEx/ | ||
Distributed under the Boost Software License, Version 1.0. | ||
(See http://www.boost.org/LICENSE_1_0.txt) | ||
=============================================================================*/ | ||
#ifndef DXLE_INC_EXCEPTION_HPP_ | ||
#define DXLE_INC_EXCEPTION_HPP_ | ||
#include "dxlibex/exception/runtime_error.hpp" | ||
#include "dxlibex/exception/invalid_argument.hpp" | ||
#include "dxlibex/exception/sound_exception.hpp" | ||
#endif //DXLE_INC_EXCEPTION_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/*============================================================================= | ||
Copyright (C) 2015-2016 DxLibEx project | ||
https://github.com/Nagarei/DxLibEx/ | ||
Distributed under the Boost Software License, Version 1.0. | ||
(See http://www.boost.org/LICENSE_1_0.txt) | ||
=============================================================================*/ | ||
#ifndef DXLE_INC_EXCEPTION_INVAID_ARGUMENT_HPP_ | ||
#define DXLE_INC_EXCEPTION_INVAID_ARGUMENT_HPP_ | ||
#include <stdexcept> | ||
#include <string> | ||
#include <cstdint> | ||
#define DXLE_INVAID_ARGUMENT_THROW_WITH_MESSAGE( MESSAGE ) throw dxle::invalid_argument(__FILE__, __FUNCTION__, __LINE__, MESSAGE) | ||
#define DXLE_INVAID_ARGUMENT_THROW_WITH_MESSAGE_IF( EXPR, MESSAGE ) if( EXPR ) throw dxle::invalid_argument(__FILE__, __FUNCTION__, __LINE__, #EXPR, MESSAGE) | ||
namespace dxle { | ||
namespace exception{ | ||
using namespace std::literals; | ||
class invalid_argument : public std::invalid_argument { | ||
protected: | ||
invalid_argument(const char* except_name, const char* sorce_name, const char* func_name, std::uint64_t line, const char* expression, const std::string& msg) | ||
: std::invalid_argument( | ||
"exception : "s + except_name + '\n' | ||
+ " in " + sorce_name + "\n" | ||
+ " " + func_name + "() (line." + std::to_string(line) + ")\n" | ||
+ " follow by below\n" | ||
+ " " + expression | ||
+ ((msg.empty() || msg[0] == '\0') ? "\n" : "\n MESSAGE : " + msg + "\n") | ||
) | ||
{} | ||
invalid_argument(const char* except_name, const char* sorce_name, const char* func_name, std::uint64_t line, const std::string& msg) | ||
: std::invalid_argument( | ||
"exception : "s + except_name + '\n' | ||
+ " in " + sorce_name + "\n" | ||
+ " " + func_name + "() (line." + std::to_string(line) + ")\n" | ||
+ ((msg.empty() || msg[0] == '\0') ? "\n" : " MESSAGE : " + msg + "\n") | ||
) | ||
{} | ||
public: | ||
invalid_argument(const char* sorce_name, const char* func_name, std::uint64_t line, const char* expression, const std::string& msg) | ||
: invalid_argument("invalid_argument", sorce_name, func_name, line, expression, msg) {} | ||
invalid_argument(const char* sorce_name, const char* func_name, std::uint64_t line, const std::string& msg) | ||
: invalid_argument("invalid_argument", sorce_name, func_name, line, msg) {} | ||
}; | ||
|
||
} | ||
using exception::invalid_argument; | ||
} | ||
#endif //DXLE_INC_EXCEPTION_INVAID_ARGUMENT_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/*============================================================================= | ||
Copyright (C) 2015-2016 DxLibEx project | ||
https://github.com/Nagarei/DxLibEx/ | ||
Distributed under the Boost Software License, Version 1.0. | ||
(See http://www.boost.org/LICENSE_1_0.txt) | ||
=============================================================================*/ | ||
#ifndef DXLE_INC_EXCEPTION_RUNTIME_ERROR_HPP_ | ||
#define DXLE_INC_EXCEPTION_RUNTIME_ERROR_HPP_ | ||
#include <stdexcept> | ||
#include <string> | ||
#include <cstdint> | ||
#define DXLE_RUNTIME_ERROR_THROW_WITH_MESSAGE( MESSAGE ) throw dxle::runtime_error(__FILE__, __FUNCTION__, __LINE__, MESSAGE) | ||
#define DXLE_RUNTIME_ERROR_THROW_WITH_MESSAGE_IF( EXPR, MESSAGE ) if( EXPR ) throw dxle::runtime_error(__FILE__, __FUNCTION__, __LINE__, #EXPR, MESSAGE) | ||
namespace dxle { | ||
namespace exception{ | ||
using namespace std::literals; | ||
class runtime_error : public std::runtime_error { | ||
protected: | ||
runtime_error(const char* except_name, const char* sorce_name, const char* func_name, std::uint64_t line, const char* expression, const std::string& msg) | ||
: std::runtime_error( | ||
"exception : "s + except_name + '\n' | ||
+ " in " + sorce_name + "\n" | ||
+ " " + func_name + "() (line." + std::to_string(line) + ")\n" | ||
+ " follow by below\n" | ||
+ " " + expression | ||
+ ((msg.empty() || msg[0] == '\0') ? "\n" : "\n MESSAGE : " + msg + "\n") | ||
) | ||
{} | ||
runtime_error(const char* except_name, const char* sorce_name, const char* func_name, std::uint64_t line, const std::string& msg) | ||
: std::runtime_error( | ||
"exception : "s + except_name + '\n' | ||
+ " in " + sorce_name + "\n" | ||
+ " " + func_name + "() (line." + std::to_string(line) + ")\n" | ||
+ ((msg.empty() || msg[0] == '\0') ? "\n" : " MESSAGE : " + msg + "\n") | ||
) | ||
{} | ||
public: | ||
runtime_error(const char* sorce_name, const char* func_name, std::uint64_t line, const char* expression, const std::string& msg) | ||
: runtime_error("runtime_error", sorce_name, func_name, line, expression, msg) {} | ||
runtime_error(const char* sorce_name, const char* func_name, std::uint64_t line, const std::string& msg) | ||
: runtime_error("runtime_error", sorce_name, func_name, line, msg) {} | ||
}; | ||
|
||
} | ||
using exception::runtime_error; | ||
} | ||
#endif //DXLE_INC_EXCEPTION_RUNTIME_ERROR_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/*============================================================================= | ||
Copyright (C) 2015-2016 DxLibEx project | ||
https://github.com/Nagarei/DxLibEx/ | ||
Distributed under the Boost Software License, Version 1.0. | ||
(See http://www.boost.org/LICENSE_1_0.txt) | ||
=============================================================================*/ | ||
#ifndef DXLE_INC_EXCEPTION_SOUND_EXCEPTION_HPP_ | ||
#define DXLE_INC_EXCEPTION_SOUND_EXCEPTION_HPP_ | ||
#include "dxlibex/exception/runtime_error.hpp" | ||
#define DXLE_SOUND_ERROR_THROW_WITH_MESSAGE( MESSAGE ) throw dxle::sound_error(__FILE__, __FUNCTION__, __LINE__, MESSAGE) | ||
#define DXLE_SOUND_ERROR_THROW_WITH_MESSAGE_IF( EXPR, MESSAGE ) if( EXPR ) throw dxle::sound_error(__FILE__, __FUNCTION__, __LINE__, #EXPR, MESSAGE) | ||
|
||
namespace dxle { | ||
namespace exception{ | ||
class sound_error : public dxle::exception::runtime_error { | ||
public: | ||
sound_error(const char* sorce_name, const char* func_name, std::uint64_t line, const char* expression, const std::string& msg) | ||
: dxle::exception::runtime_error("sound_error", sorce_name, func_name, line, expression, msg) {} | ||
sound_error(const char* sorce_name, const char* func_name, std::uint64_t line, const std::string& msg) | ||
: dxle::exception::runtime_error("sound_error", sorce_name, func_name, line, msg) {} | ||
}; | ||
|
||
} | ||
using exception::sound_error; | ||
} | ||
|
||
#endif //DXLE_INC_EXCEPTION_SOUND_EXCEPTION_HPP_ |