libmx2
2.2.1
C++20 multimedia and game-engine library (SDL2 / OpenGL / Vulkan)
Loading...
Searching...
No Matches
exception.hpp
Go to the documentation of this file.
1
/**
2
* @file exception.hpp
3
* @brief Exception type used throughout libmx.
4
*/
5
#ifndef __MX_E__
6
#define __MX_E__
7
8
#include<iostream>
9
#include<string>
10
11
namespace
mx
{
12
13
/**
14
* @class Exception
15
* @brief General-purpose exception class for the mx library.
16
*
17
* Wraps a human-readable error message that can be retrieved via text().
18
* Throw this instead of std::exception wherever a libmx error occurs.
19
*/
20
class
Exception
{
21
public
:
22
/**
23
* @brief Construct an exception with the given message.
24
* @param text_ Human-readable description of the error.
25
*/
26
explicit
Exception
(
const
std::string &text_);
27
28
/**
29
* @brief Retrieve the error message.
30
* @return The message string passed at construction.
31
*/
32
std::string
text
()
const
;
33
private
:
34
std::string
text_value
;
///< Stored error message.
35
};
36
}
37
38
#endif
mx::Exception::text_value
std::string text_value
Stored error message.
Definition
exception.hpp:34
mx::Exception::text
std::string text() const
Retrieve the error message.
Definition
exception.cpp:9
mx::Exception::Exception
Exception(const std::string &text_)
Construct an exception with the given message.
Definition
exception.cpp:8
mx
Definition
cfg.cpp:11
libmx
libmx
exception.hpp
Generated by
1.16.1