Commit ece35552 authored by Max Kellermann's avatar Max Kellermann

config/Block: add ThrowWithNested()

parent 7d599c1a
...@@ -26,6 +26,13 @@ ...@@ -26,6 +26,13 @@
#include <assert.h> #include <assert.h>
#include <stdlib.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 int
BlockParam::GetIntValue() const BlockParam::GetIntValue() const
{ {
......
...@@ -51,6 +51,14 @@ struct BlockParam { ...@@ -51,6 +51,14 @@ struct BlockParam {
unsigned GetPositiveValue() const; unsigned GetPositiveValue() const;
bool GetBoolValue() 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 { struct ConfigBlock {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment