Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ValueChecker.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 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/* ValueChecker.cc (C) 2000-2016 */
9/* */
10/* Fonctions pour convertir un type en un autre. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArcanePrecomp.h"
15
16#include "arcane/utils/FatalErrorException.h"
17#include "arcane/utils/ValueChecker.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22ARCANE_BEGIN_NAMESPACE
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27void ValueChecker::
28_addError(const String& message)
29{
30 ++m_nb_error;
31 if (m_throw_on_error){
32 throw FatalErrorException(m_trace_info,message);
33 }
34 else{
35 m_last_error_str = message;
36 m_ostr() << message << '\n';
37 }
38}
39
40/*---------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------*/
42
43void ValueChecker::
44throwIfError()
45{
46 if (m_nb_error!=0){
47 m_nb_error = 0;
48 throw FatalErrorException(m_trace_info,m_ostr.str());
49 }
50}
51
52/*---------------------------------------------------------------------------*/
53/*---------------------------------------------------------------------------*/
54
55ARCANE_END_NAMESPACE
56
57/*---------------------------------------------------------------------------*/
58/*---------------------------------------------------------------------------*/
59
Exception lorsqu'une erreur fatale est survenue.