aGrUM
3.3.2
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
exceptions_inl.h
Go to the documentation of this file.
1
/****************************************************************************
2
* This file is part of the aGrUM/pyAgrum library. *
3
* *
4
* Copyright (c) 2005-2026 by *
5
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
6
* - Christophe GONZALES(_at_AMU) *
7
* *
8
* The aGrUM/pyAgrum library is free software; you can redistribute it *
9
* and/or modify it under the terms of either : *
10
* *
11
* - the GNU Lesser General Public License as published by *
12
* the Free Software Foundation, either version 3 of the License, *
13
* or (at your option) any later version, *
14
* - the MIT license (MIT), *
15
* - or both in dual license, as here. *
16
* *
17
* (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18
* *
19
* This aGrUM/pyAgrum library is distributed in the hope that it will be *
20
* useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26
* OTHER DEALINGS IN THE SOFTWARE. *
27
* *
28
* See LICENCES for more details. *
29
* *
30
* SPDX-FileCopyrightText: Copyright 2005-2026 *
31
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
32
* - Christophe GONZALES(_at_AMU) *
33
* SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34
* *
35
* Contact : info_at_agrum_dot_org *
36
* homepage : http://agrum.gitlab.io *
37
* gitlab : https://gitlab.com/agrumery/agrum *
38
* *
39
****************************************************************************/
40
41
#pragma once
42
43
#include <
agrum/base/core/exceptions.h
>
44
#include <
agrum/base/core/inline.h
>
45
#include <
agrum/base/core/types.h
>
46
47
namespace
gum
{
48
49
50
GUM_NODISCARD
INLINE
const
char
*
Exception::what
() const noexcept {
return
what_
.c_str(); }
51
52
GUM_NODISCARD
INLINE std::string
Exception::errorContent
()
const
{
return
msg_
; }
53
54
GUM_NODISCARD
INLINE std::string
Exception::errorType
()
const
{
return
type_
; }
55
56
GUM_NODISCARD
INLINE std::string
Exception::errorCallStack
()
const
{
return
callstack_
; }
57
58
#ifdef GUM_FOR_SWIG
59
GUM_NODISCARD
INLINE
const
char
* Exception::pythonClassName_() const noexcept {
60
return
"Exception"
;
61
}
62
#endif
// GUM_FOR_SWIG
63
64
INLINE
65
SyntaxError::SyntaxError(
const
std::string& aMsg,
66
std::string aFilename,
67
Size nol,
68
Size noc,
69
const
std::string& aType) :
70
IOError
(aMsg, aType), noLine_(nol), noCol_(noc), filename_(
std
::move(aFilename)) {
71
#ifdef GUM_FOR_SWIG
72
what_
=
"[pyAgrum] "
+
msg_
;
73
#else
// GUM_FOR_SWIG
74
std::ostringstream error_stream;
75
error_stream <<
type_
<<
":"
<< std::endl;
76
error_stream << filename() <<
":"
<< line() <<
","
<< col() <<
" : "
<<
msg_
;
77
what_
= error_stream.str();
78
#endif
// GUM_FOR_SWIG
79
}
80
81
GUM_NODISCARD
INLINE
Size
SyntaxError::col()
const
{
return
noCol_; }
82
83
GUM_NODISCARD
INLINE
Size
SyntaxError::line()
const
{
return
noLine_; }
84
85
GUM_NODISCARD
INLINE std::string SyntaxError::filename()
const
{
return
filename_; }
86
87
}
// namespace gum
gum::Exception::callstack_
std::string callstack_
Definition
exceptions.h:137
gum::Exception::msg_
std::string msg_
Definition
exceptions.h:135
gum::Exception::errorCallStack
GUM_NODISCARD std::string errorCallStack() const
Returns the error call stack.
Definition
exceptions_inl.h:56
gum::Exception::what_
std::string what_
Definition
exceptions.h:138
gum::Exception::errorContent
GUM_NODISCARD std::string errorContent() const
Returns the message content.
Definition
exceptions_inl.h:52
gum::Exception::what
GUM_NODISCARD const char * what() const noexcept override
Definition
exceptions_inl.h:50
gum::Exception::errorType
GUM_NODISCARD std::string errorType() const
Returns the error type.
Definition
exceptions_inl.h:54
gum::Exception::type_
std::string type_
Definition
exceptions.h:136
IOError
Exception : input/output problem.
exceptions.h
aGrUM's exceptions
gum::Size
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition
types.h:74
inline.h
aGrUM's inline/outline selection
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
std
STL namespace.
types.h
Provides basic types used in aGrUM.
GUM_NODISCARD
#define GUM_NODISCARD
Definition
types.h:61
aGrUM
3.3.2
© PHW&CG&others - 2022
DoXyGeN 1.18.0