0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-08 04:58:58 +02:00

ircd:Ⓜ️ Rethrow ircd::error to prevent shlib RTTI/personality dependency for m::error.

This commit is contained in:
Jason Volk 2020-02-19 12:03:07 -08:00
parent d934934605
commit 860087b6ce
2 changed files with 25 additions and 1 deletions

View file

@ -167,6 +167,7 @@ ircd::m::homeserver::primary;
IRCD_MODULE_EXPORT
ircd::m::homeserver *
ircd::m::homeserver::init(const struct opts *const opts)
try
{
assert(opts);
rfc3986::valid_host(opts->origin);
@ -176,6 +177,20 @@ ircd::m::homeserver::init(const struct opts *const opts)
opts
};
}
catch(const m::error &e)
{
assert(opts);
// Don't rethrow m::error so the catcher doesn't depend on
// RTTI/personality from this shlib after it unloads.
throw ircd::error
{
"Failed to initialize homeserver %s of %s :%s :%s",
opts->server_name,
opts->origin,
e.errcode(),
e.errstr(),
};
}
void
IRCD_MODULE_EXPORT

View file

@ -196,7 +196,16 @@ catch(const m::error &e)
e.errstr(),
};
throw;
// Don't rethrow m::error so the catcher doesn't depend on
// RTTI/personality from this shlib after it unloads.
throw ircd::error
{
"Failed to start matrix (%u) %s :%s :%s",
uint(e.code),
http::status(e.code),
e.errcode(),
e.errstr(),
};
}
catch(const std::exception &e)
{