config/Block: add ThrowWithNested()

This commit is contained in:
Max Kellermann 2019-05-29 22:33:51 +02:00
parent 7d599c1afc
commit ece35552fe
2 changed files with 15 additions and 0 deletions

View File

@ -26,6 +26,13 @@
#include <assert.h>
#include <stdlib.h>
void
BlockParam::ThrowWithNested() const
{
std::throw_with_nested(FormatRuntimeError("Error in setting \"%s\" on line %i",
name.c_str(), line));
}
int
BlockParam::GetIntValue() const
{

View File

@ -51,6 +51,14 @@ struct BlockParam {
unsigned GetPositiveValue() const;
bool GetBoolValue() const;
/**
* Call this method in a "catch" block to throw a nested
* exception showing the location of this setting in the
* configuration file.
*/
[[noreturn]]
void ThrowWithNested() const;
};
struct ConfigBlock {