16#include "arccore/base/Exception.h"
17#include "arccore/trace/ITraceMng.h"
43 const char* _noContinueString(
bool is_no_continue)
45 return (is_no_continue) ?
"** Can't continue with the execution.\n" :
"";
55 const char* nc = _noContinueString(is_no_continue);
56 const char* msg_str =
"** An unknowed error occured...\n";
58 msg->
error() << msg_str << nc;
61 std::cerr << msg_str << nc;
70print(
const std::exception& ex,
ITraceMng* msg,
bool is_no_continue)
72 const char* nc = _noContinueString(is_no_continue);
74 msg->
error() <<
"** A standard exception occured: " << ex.what() <<
".\n"
78 std::cerr <<
"** A standard exception occured: " << ex.what() <<
".\n"
90 const char* nc = _noContinueString(is_no_continue);
93 msg->
error() << ex <<
'\n'
97 std::cerr <<
"EXCEPTION: " << ex <<
'\n'
107callWithTryCatch(std::function<
void()> function,
ITraceMng* tm)
113 return print(ex, tm,
false);
115 catch (
const std::exception& ex) {
116 return print(ex, tm,
false);
119 return print(tm,
false);
128callAndTerminateIfThrow(std::function<
void()> function,
ITraceMng* tm)
132 std::cerr <<
"Exception catched in arcaneCallFunctionAndTerminateIfThrow: calling std::terminate()\n";
Fonctions utilitaires pour la gestion des exceptions.
ARCCORE_COMMON_EXPORT Int32 print(ITraceMng *tm, bool is_no_continue=true)
Imprime un message pour une exception inconnue.
ARCCORE_COMMON_EXPORT Int32 callWithTryCatch(std::function< void()> function, ITraceMng *tm=nullptr)
Appelle une fonction en récupérant et affichant les exceptions.
Classe de base d'une exception.
bool isCollective() const
Vrai s'il s'agit d'une erreur collective (concerne tous les processeurs)
Interface du gestionnaire de traces.
virtual TraceMessage error()=0
Flot pour un message d'erreur.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
std::int32_t Int32
Type entier signé sur 32 bits.