/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer] */ #ifndef CBM_ALGO_BASE_EXCEPTIONS_H #define CBM_ALGO_BASE_EXCEPTIONS_H #include <exception> #include <fmt/format.h> namespace cbm::algo { /** * @brief Base class for exceptions */ class Exception : public std::runtime_error { public: template<typename... Args> Exception(const char* fmt, Args&&... args) : std::runtime_error(fmt::format(fmt, std::forward<Args>(args)...)) { } }; /** * @brief Indicates an unrecoverable error. Should tear down the process. */ class FatalError : public Exception { using Exception::Exception; }; /** * Indicates an error during timeslice processing. Timeslice will be discarded. * Processing can continue with new timeslice. */ class ProcessingError : public Exception { using Exception::Exception; }; } // namespace cbm::algo #endif