blob: e87bb76815f33f0ae62f309ba97950465c1474da (
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
27
28
29
30
31
32
33
34
35
36
|
/*
* This source code is released into the public domain.
*/
#ifndef LFJAIL_CONFIG_ERROR_HH
#define LFJAIL_CONFIG_ERROR_HH
#include <format>
#include <stdexcept>
#include <string>
#include <utility>
namespace lfjail::config {
/*
* Exception thrown when an issue occurs with the configuration.
*/
struct error : std::runtime_error {
template<typename... Args>
error(std::format_string<Args...> fmt, Args &&...args)
: std::runtime_error(std::format(fmt, std::forward<Args>(args)...))
{}
};
struct unknown_setting final : error {
std::string varname;
unknown_setting(std::string_view varname_)
: error("unknown configuration variable '{0}'", varname_)
, varname(varname_)
{}
};
} // namespace lfjail::config
#endif // !LFJAIL_CONFIG_ERROR_HH
|