Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
CaseOptionError.h
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/* CaseOptionError.h (C) 2000-2025 */
9/* */
10/* Dataset error. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_CASEOPTIONERROR_H
13#define ARCANE_CORE_CASEOPTIONERROR_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/String.h"
18#include "arcane/utils/TraceInfo.h"
19
20#include "arcane/core/XmlNode.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31class ICaseDocument;
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
37/*!
38 * \ingroup CaseOption
39 * \brief Error in the dataset.
40 */
41class ARCANE_CORE_EXPORT CaseOptionError
42{
43 public:
44
45 //! Generic error
46 CaseOptionError(const TraceInfo& where, const String& node_name,
47 const String& message, bool is_collective = false);
48
49 public:
50
51 /*!
52 * \brief Error when a dataset value is not of the correct type.
53 * This error is collective.
54 */
55 static void addInvalidTypeError(ICaseDocumentFragment* document,
56 const TraceInfo& where,
57 const String& node_name,
58 const XmlNode& parent,
59 const String& value,
60 const String& expected_type);
61
62 /*!
63 * \brief Error when a dataset value is not of the correct type.
64 * This error is collective.
65 */
66 static void addInvalidTypeError(ICaseDocumentFragment* document,
67 const TraceInfo& where,
68 const String& node_name,
69 const XmlNode& parent,
70 const String& value,
71 const String& expected_type,
72 StringConstArrayView valid_values);
73
74 /*!
75 * \brief Error when a dataset option is not found.
76 * This error is collective.
77 */
79 const TraceInfo& where,
80 const String& node_name,
81 const XmlNode& parent);
82
83 //! Generic error
84 static void addError(ICaseDocumentFragment* document,
85 const TraceInfo& where, const String& node_name,
86 const String& message, bool is_collective = false);
87
88 //! Generic error
89 static void addWarning(ICaseDocumentFragment* document,
90 const TraceInfo& where, const String& node_name,
91 const String& message, bool is_collective = false);
92
93 public:
94
95 const String& nodeName() const { return m_node_name; }
96
97 const String& message() const { return m_message; }
98
99 bool isCollective() const { return m_is_collective; }
100
101 const TraceInfo& trace() const { return m_func_info; }
102
103 private:
104
105 TraceInfo m_func_info;
106 String m_node_name;
107 String m_message;
108 bool m_is_collective;
109};
110
111/*---------------------------------------------------------------------------*/
112/*---------------------------------------------------------------------------*/
113
114} // End namespace Arcane
115
116/*---------------------------------------------------------------------------*/
117/*---------------------------------------------------------------------------*/
118
119#endif
static void addWarning(ICaseDocumentFragment *document, const TraceInfo &where, const String &node_name, const String &message, bool is_collective=false)
Generic error.
static void addError(ICaseDocumentFragment *document, const TraceInfo &where, const String &node_name, const String &message, bool is_collective=false)
Generic error.
CaseOptionError(const TraceInfo &where, const String &node_name, const String &message, bool is_collective=false)
Generic error.
static void addInvalidTypeError(ICaseDocumentFragment *document, const TraceInfo &where, const String &node_name, const XmlNode &parent, const String &value, const String &expected_type)
Error when a dataset value is not of the correct type. This error is collective.
static void addOptionNotFoundError(ICaseDocumentFragment *document, const TraceInfo &where, const String &node_name, const XmlNode &parent)
Error when a dataset option is not found. This error is collective.
Node of a DOM tree.
Definition XmlNode.h:51
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
ConstArrayView< String > StringConstArrayView
C equivalent of a 1D array of strings.
Definition UtilsTypes.h:492