Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ExceptionUtils.h
Go to the documentation of this file.
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ExceptionUtils.h (C) 2000-2025 */
9/* */
10/* Utility functions for exception handling. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_COMMON_EXCEPTIONUTILS_H
13#define ARCCORE_COMMON_EXCEPTIONUTILS_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18#include "arccore/common/CommonGlobal.h"
19
20#include <functional>
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane::ExceptionUtils
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
42extern "C++" ARCCORE_COMMON_EXPORT Int32
43print(ITraceMng* tm, bool is_no_continue = true);
44
45/*---------------------------------------------------------------------------*/
46/*---------------------------------------------------------------------------*/
47
57extern "C++" ARCCORE_COMMON_EXPORT Int32
58print(const std::exception& ex, ITraceMng* tm, bool is_no_continue = true);
59
60/*---------------------------------------------------------------------------*/
61/*---------------------------------------------------------------------------*/
62
72extern "C++" ARCCORE_COMMON_EXPORT Int32
73print(const Exception& ex, ITraceMng* tm, bool is_no_continue = true);
74
75/*---------------------------------------------------------------------------*/
76/*---------------------------------------------------------------------------*/
77
93extern "C++" ARCCORE_COMMON_EXPORT Int32
94callWithTryCatch(std::function<void()> function, ITraceMng* tm = nullptr);
95
96/*---------------------------------------------------------------------------*/
97/*---------------------------------------------------------------------------*/
98
105extern "C++" ARCCORE_COMMON_EXPORT void
106callAndTerminateIfThrow(std::function<void()> function, ITraceMng* tm = nullptr);
107
108/*---------------------------------------------------------------------------*/
109/*---------------------------------------------------------------------------*/
110
111} // namespace Arcane::ExceptionUtils
112
113/*---------------------------------------------------------------------------*/
114/*---------------------------------------------------------------------------*/
115
116#endif
Declarations of types for the 'base' component of Arccore.
Int32 print(ITraceMng *tm, bool is_no_continue=true)
Prints a message for an unknown exception.
void callAndTerminateIfThrow(std::function< void()> function, ITraceMng *tm=nullptr)
Calls a function and terminates the program if an exception occurs.
Int32 callWithTryCatch(std::function< void()> function, ITraceMng *tm=nullptr)
Calls a function while catching and displaying exceptions.
std::int32_t Int32
Signed integer type of 32 bits.