16#include "arccore/base/Exception.h"
17#include "arccore/trace/ITraceMng.h"
46 const char* _noContinueString(
bool is_no_continue)
48 return (is_no_continue) ?
"** Can't continue with the execution.\n" :
"";
58 const char* nc = _noContinueString(is_no_continue);
59 const char* msg_str =
"** An unknowed error occured...\n";
61 msg->
error() << msg_str << nc;
64 std::cerr << msg_str << nc;
73print(
const std::exception& ex,
ITraceMng* msg,
bool is_no_continue)
75 const char* nc = _noContinueString(is_no_continue);
77 msg->
error() <<
"** A standard exception occured: " << ex.what() <<
".\n"
81 std::cerr <<
"** A standard exception occured: " << ex.what() <<
".\n"
93 const char* nc = _noContinueString(is_no_continue);
96 msg->
error() << ex <<
'\n'
100 std::cerr <<
"EXCEPTION: " << ex <<
'\n'
110callWithTryCatch(std::function<
void()> function,
ITraceMng* tm)
116 return print(ex, tm,
false);
118 catch (
const std::exception& ex) {
119 return print(ex, tm,
false);
122 return print(tm,
false);
131callAndTerminateIfThrow(std::function<
void()> function,
ITraceMng* tm)
135 std::cerr <<
"Exception catched in arcaneCallFunctionAndTerminateIfThrow: calling std::terminate()\n";
Utility functions for exception handling.
Int32 print(ITraceMng *tm, bool is_no_continue=true)
Prints a message for an unknown exception.
Int32 callWithTryCatch(std::function< void()> function, ITraceMng *tm=nullptr)
Calls a function while catching and displaying exceptions.
Base class for an exception.
bool isCollective() const
True if it is a collective error (concerns all processors).
virtual TraceMessage error()=0
Stream for an error message.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int32_t Int32
Signed integer type of 32 bits.