Skip to content
Snippets Groups Projects
Error.h 1.2 KiB
Newer Older
  • Learn to ignore specific revisions
  •  * \copyright
    
     * Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org)
    
     *            Distributed under a Modified BSD License.
     *              See accompanying file LICENSE.txt or
     *              http://www.opengeosys.org/project/license
     *
     */
    
    
    Norihiro Watanabe's avatar
    Norihiro Watanabe committed
    #include <cstdlib>
    
    Dmitri Naumov's avatar
    Dmitri Naumov committed
    
    
    #include "Logging.h"
    
    #ifdef OGS_FATAL_ABORT
    #define OGS_FATAL(...)                                                      \
        {                                                                       \
            BaseLib::console->critical("{}:{} {}() ", __FILE__, __LINE__,       \
                                       __FUNCTION__, fmt::format(__VA_ARGS__)); \
            std::abort();                                                       \
        }
    
    #else  // OGS_FATAL_ABORT
    
    Norihiro Watanabe's avatar
    Norihiro Watanabe committed
    #include <stdexcept>
    
    #define OGS_FATAL(...)                                                      \
        {                                                                       \
            BaseLib::console->critical("{}:{} {}() ", __FILE__, __LINE__,       \
                                       __FUNCTION__, fmt::format(__VA_ARGS__)); \
            throw std::runtime_error(fmt::format(__VA_ARGS__));                 \
        }
    
    #endif  // OGS_FATAL_ABORT