Arcane  v4.1.1.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
Référence du fichier ExceptionUtils.h

Fonctions utilitaires pour la gestion des exceptions. Plus de détails...

#include "arccore/base/BaseTypes.h"
#include "arccore/common/CommonGlobal.h"
#include <functional>
+ Graphe des dépendances par inclusion de ExceptionUtils.h:
+ Ce graphe montre quels fichiers incluent directement ou indirectement ce fichier :

Aller au code source de ce fichier.

Espaces de nommage

namespace  Arcane
 -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
 

Fonctions

ARCCORE_COMMON_EXPORT Int32 Arcane::ExceptionUtils::print (ITraceMng *tm, bool is_no_continue=true)
 Imprime un message pour une exception inconnue.
 
ARCCORE_COMMON_EXPORT Int32 Arcane::ExceptionUtils::print (const std::exception &ex, ITraceMng *tm, bool is_no_continue=true)
 Imprime un message pour l'exception standard ex.
 
ARCCORE_COMMON_EXPORT Int32 Arcane::ExceptionUtils::print (const Exception &ex, ITraceMng *tm, bool is_no_continue=true)
 Imprime un message pour l'exception standard ex.
 
ARCCORE_COMMON_EXPORT Int32 Arcane::ExceptionUtils::callWithTryCatch (std::function< void()> function, ITraceMng *tm=nullptr)
 Appelle une fonction en récupérant et affichant les exceptions.
 
ARCCORE_COMMON_EXPORT void Arcane::ExceptionUtils::callAndTerminateIfThrow (std::function< void()> function, ITraceMng *tm=nullptr)
 Appelle une fonction et termine le programme en cas d'exception.
 

Description détaillée

Fonctions utilitaires pour la gestion des exceptions.

Définition dans le fichier ExceptionUtils.h.

Documentation des fonctions

◆ callAndTerminateIfThrow()

void Arcane::ExceptionUtils::callAndTerminateIfThrow ( std::function< void()> function,
ITraceMng * tm = nullptr )

Appelle une fonction et termine le programme en cas d'exception.

Appelle la fonction function via callWithTryCatch() et appelle std::terminate() en cas d'exception.

Définition à la ligne 127 du fichier ExceptionUtils.cc.

◆ callWithTryCatch()

Int32 Arcane::ExceptionUtils::callWithTryCatch ( std::function< void()> function,
ITraceMng * tm = nullptr )

Appelle une fonction en récupérant et affichant les exceptions.

Applique la fonction function et récupère les éventuelles exceptions. En cas d'exception, la fonction print() est appelée pour afficher un message et le code de retour est celui de la fonction print().

Usage:

callWithTryCatch([&]() { std::cout << "Hello\n"});
Renvoie
0 si aucune exception n'est lancée et une valeur positive dans le cas contraire.

Définition à la ligne 106 du fichier ExceptionUtils.cc.

◆ print() [1/3]

Int32 Arcane::ExceptionUtils::print ( const Exception & ex,
ITraceMng * tm,
bool is_no_continue = true )

Imprime un message pour l'exception standard ex.

Si tm est non nul, il sera utilisé pour l'impression. Si is_no_continue est vrai, affiche un message indiquant qu'on ne peut plus continuer l'exécution.

Valeurs retournées
3

Définition à la ligne 87 du fichier ExceptionUtils.cc.

Références Arcane::ITraceMng::error(), et Arcane::Exception::isCollective().

+ Voici le graphe d'appel pour cette fonction :

◆ print() [2/3]

Int32 Arcane::ExceptionUtils::print ( const std::exception & ex,
ITraceMng * tm,
bool is_no_continue = true )

Imprime un message pour l'exception standard ex.

Si trace_mng est non nul, il sera utilisé pour l'impression. Si is_no_continue est vrai, affiche un message indiquant qu'on ne peut plus continuer l'exécution.

Valeurs retournées
2

Définition à la ligne 69 du fichier ExceptionUtils.cc.

Références Arcane::ITraceMng::error().

+ Voici le graphe d'appel pour cette fonction :

◆ print() [3/3]

Int32 Arcane::ExceptionUtils::print ( ITraceMng * tm,
bool is_no_continue = true )

Imprime un message pour une exception inconnue.

Cette fonction sert pour les expressions du type catch(...).

Si trace_mng est non nul, il sera utilisé pour l'impression. Si is_no_continue est vrai, affiche un message indiquant qu'on ne peut plus continuer l'exécution.

Valeurs retournées
1

Définition à la ligne 52 du fichier ExceptionUtils.cc.

Références Arcane::ITraceMng::error().

+ Voici le graphe d'appel pour cette fonction :