Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ValueChecker.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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/* Functions to convert one type to another. */
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
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28void ValueChecker::
29_addError(const String& message)
30{
31 ++m_nb_error;
32 if (m_throw_on_error) {
33 throw FatalErrorException(m_trace_info, message);
34 }
35 else {
36 m_last_error_str = message;
37 m_ostr() << message << '\n';
38 }
39}
40
41/*---------------------------------------------------------------------------*/
42/*---------------------------------------------------------------------------*/
43
46{
47 if (m_nb_error != 0) {
48 m_nb_error = 0;
49 throw FatalErrorException(m_trace_info, m_ostr.str());
50 }
51}
52
53/*---------------------------------------------------------------------------*/
54/*---------------------------------------------------------------------------*/
55
56} // namespace Arcane
57
58/*---------------------------------------------------------------------------*/
59/*---------------------------------------------------------------------------*/
void throwIfError()
Throws an exception if nbError()!=0.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --