aboutsummaryrefslogtreecommitdiffstats
path: root/modules/generic_error.ccm
blob: a5825190878c42011005326f4d581f564dedf693 (plain) (blame)
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
/*
 * This source code is released into the public domain.
 */

module;

#include <format>
#include <stdexcept>

export module nihil:generic_error;

namespace nihil {

/*
 * generic_error is the base class that all other exceptions derive from.
 * It is an std::runtime_error, and what() should always be informative.
 */

export struct generic_error : std::runtime_error {
	template<typename... Args>
	generic_error(std::format_string<Args...> fmt, Args &&...args)
		: std::runtime_error(std::format(fmt, std::forward<Args>(args)...))
	{}
};

} // namespace nihil