Commit a69c3c18 authored by Max Kellermann's avatar Max Kellermann

neighbor/Glue: support C++ exceptions

parent 50e5244e
......@@ -27,6 +27,9 @@
#include "config/ConfigError.hxx"
#include "config/Block.hxx"
#include "util/Error.hxx"
#include "util/RuntimeError.hxx"
#include <stdexcept>
NeighborGlue::Explorer::~Explorer()
{
......@@ -61,14 +64,20 @@ NeighborGlue::Init(EventLoop &loop, NeighborListener &listener, Error &error)
{
for (const auto *block = config_get_block(ConfigBlockOption::NEIGHBORS);
block != nullptr; block = block->next) {
NeighborExplorer *explorer =
CreateNeighborExplorer(loop, listener, *block, error);
if (explorer == nullptr) {
error.FormatPrefix("Line %i: ", block->line);
return false;
try {
auto *explorer =
CreateNeighborExplorer(loop, listener, *block,
error);
if (explorer == nullptr) {
error.FormatPrefix("Line %i: ", block->line);
return false;
}
explorers.emplace_front(explorer);
} catch (...) {
std::throw_with_nested(FormatRuntimeError("Line %i: ",
block->line));
}
explorers.emplace_front(explorer);
}
return true;
......
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