0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-15 14:31:11 +01:00

ircd: ircd::main() exception specification.

This commit is contained in:
Jason Volk 2018-03-16 15:16:14 -07:00
parent a632db39d0
commit 03651c2274

View file

@ -25,7 +25,7 @@ namespace ircd
void set_runlevel(const enum runlevel &); void set_runlevel(const enum runlevel &);
void at_main_exit() noexcept; void at_main_exit() noexcept;
void main(); void main() noexcept;
} }
/// Record of the ID of the thread static initialization took place on. /// Record of the ID of the thread static initialization took place on.
@ -169,7 +169,7 @@ noexcept
/// ///
void void
ircd::main() ircd::main()
try noexcept try
{ {
// Resamples the thread this context was executed on which should be where // Resamples the thread this context was executed on which should be where
// the user ran ios.run(). The user may have invoked ios.run() on multiple // the user ran ios.run(). The user may have invoked ios.run() on multiple
@ -245,24 +245,13 @@ catch(const ctx::interrupted &e)
"IRCd main interrupted..." "IRCd main interrupted..."
}; };
} }
#ifndef RB_DEBUG
catch(const std::exception &e) catch(const std::exception &e)
{ {
// When not in debug mode this is a clean return to not crash through
// the embedder's ios.run() which would terminate the rest of their
// program. Instead they have the right to handle the error and try again.
log::critical log::critical
{ {
"IRCd main exited: %s", e.what() "IRCd main exited: %s", e.what()
}; };
} }
#else
catch(...)
{
// In debug mode we terminate with a message and a coredump
ircd::terminate();
}
#endif // RB_DEBUG
void void
ircd::at_main_exit() ircd::at_main_exit()