14#include "arcane/utils/Exception.h"
15#include "arcane/utils/ITraceMng.h"
30const char* _noContinueString(
bool is_no_continue)
32 return (is_no_continue) ?
"** Can't continue with the execution.\n" :
"";
39extern "C++" ARCANE_UTILS_EXPORT
Integer
40arcanePrintAnyException(ITraceMng* msg,
bool is_no_continue)
42 const char* nc = _noContinueString(is_no_continue);
43 const char* msg_str =
"** An unknowed error occured...\n";
45 msg->error() << msg_str << nc;
48 std::cerr << msg_str << nc;
56extern "C++" ARCANE_UTILS_EXPORT
Integer
57arcanePrintStdException(
const std::exception& ex,ITraceMng* msg,
bool is_no_continue)
59 const char* nc = _noContinueString(is_no_continue);
61 msg->error() <<
"** A standard exception occured: " << ex.what() <<
".\n" << nc;
64 std::cerr <<
"** A standard exception occured: " << ex.what() <<
".\n" << nc;
72extern "C++" ARCANE_UTILS_EXPORT
Integer
73arcanePrintArcaneException(
const Exception& ex,ITraceMng* msg,
bool is_no_continue)
75 const char* nc = _noContinueString(is_no_continue);
77 if (!ex.isCollective() || msg->isMaster())
78 msg->error() << ex <<
'\n' << nc;
81 std::cerr <<
"EXCEPTION: " << ex <<
'\n' << nc;
89extern "C++" ARCANE_UTILS_EXPORT
Integer
96 return arcanePrintArcaneException(ex,
nullptr,
false);
98 catch(
const std::exception& ex){
99 return arcanePrintStdException(ex,
nullptr,
false);
102 return arcanePrintAnyException(
nullptr,
false);
110extern "C++" ARCANE_UTILS_EXPORT
void
115 std::cerr <<
"Exception catched in arcaneCallFunctionAndTerminateIfThrow: calling std::terminate()\n";
Classe de base d'une exception.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Integer arcaneCallFunctionAndCatchException(std::function< void()> function)
void arcaneCallFunctionAndTerminateIfThrow(std::function< void()> function)
Int32 Integer
Type représentant un entier.