diff options
| author | 2025-03-18 13:12:28 +0000 | |
|---|---|---|
| committer | 2025-03-18 13:12:28 +0000 | |
| commit | 8adda0dca4cb94be6a071e67b3e3c89a22375aca (patch) | |
| tree | e68839d6da2df39b3ba43a8665e44a9a98c6c16c /include | |
| parent | Skip lines which are empty in mkheaders. (diff) | |
Add a formatting overload of the ModuleException constructor.
Diffstat (limited to 'include')
| -rw-r--r-- | include/exception.h | 12 |
1 files changed, 12 insertions, 0 deletions
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 <typename... Args> + 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. |
