From 8adda0dca4cb94be6a071e67b3e3c89a22375aca Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 18 Mar 2025 13:12:28 +0000 Subject: Add a formatting overload of the ModuleException constructor. --- include/exception.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include') diff --git a/include/exception.h b/include/exception.h index b0c3c9c06..693e926b7 100644 --- a/include/exception.h +++ b/include/exception.h @@ -54,6 +54,18 @@ private: const Module* module; public: + + /** Creates a new instance of the ModuleException class with the specified module instance and reason. + * @param mod The module which threw this exception. + * @param format A format string for a message that contains the reason this exception was thrown. + * @param args The arguments to format the message. + */ + template + ModuleException(const Module* mod, const char* format, Args&&... args) + : ModuleException(mod, fmt::vformat(format, fmt::make_format_args(args...))) + { + } + /** Creates a new instance of the ModuleException class with the specified module instance and reason. * @param mod The module which threw this exception. * @param message A message that contains the reason this exception was thrown. -- cgit v1.3.1-10-gc9f91