47#ifndef GUM_EXCEPTIONS_H
48#define GUM_EXCEPTIONS_H
57#include <agrum/config.h>
63#define GUM_ERROR_IN_EXPR(type, msg) throw(type(msg))
65#if defined(SWIG) || defined(GUM_FOR_SWIG)
67# define GUM_ERROR(type, msg) \
69 std::ostringstream err_stream; \
71 throw(type(err_stream.str())); \
73# define GUM_SHOWERROR(e) \
74 { std::cout << std::endl << (e).what() << std::endl; }
76# define GUM_ERROR(type, msg) \
78 std::ostringstream error_stream; \
79 error_stream << msg; \
80 throw(type(gum::_createMsg_(__FILE__, __FUNCTION__, __LINE__, error_stream.str()))); \
83# define GUM_SHOWERROR(e) \
85 std::cout << std::endl << __FILE__ << ":" << __LINE__ << " " << (e).what() << std::endl; \
86 std::cout << (e).errorCallStack() << std::endl; \
89# define GUM_SHOWERROR(e) \
90 { std::cout << std::endl << __FILE__ << ":" << __LINE__ << " " << (e).what() << std::endl; }
95# define GUM_MAKE_ERROR(TYPE, SUPERCLASS, MSG) \
96 class GUM_SHARED_PUBLIC TYPE: public SUPERCLASS { \
98 explicit TYPE(const std::string& aMsg, const std::string& aType = MSG) : \
99 SUPERCLASS(aMsg, aType) {} \
100 TYPE(const TYPE& src) : SUPERCLASS(src) {} \
101 const char* pythonClassName_() const noexcept override { return #TYPE; } \
104# define GUM_MAKE_ERROR(TYPE, SUPERCLASS, MSG) \
105 class GUM_SHARED_PUBLIC TYPE: public SUPERCLASS { \
107 explicit TYPE(const std::string& aMsg, const std::string& aType = MSG) : \
108 SUPERCLASS(aMsg, aType) {} \
109 TYPE(const TYPE& src) : SUPERCLASS(src) {} \
114# define GUM_SYNTAX_ERROR(msg, filename, line, column) \
116 std::ostringstream error_stream; \
117 error_stream << msg; \
118 throw(gum::SyntaxError(error_stream.str(), filename, line, column)); \
121# define GUM_SYNTAX_ERROR(msg, filename, line, column) \
123 std::ostringstream error_stream; \
124 error_stream << msg; \
125 throw(gum::SyntaxError(error_stream.str(), filename, line, column)); \
133 class GUM_SHARED_PUBLIC
Exception:
public std::exception {
145 explicit Exception(std::string_view aMsg =
"", std::string_view aType =
"Generic error");
183 GUM_NODISCARD virtual const char* pythonClassName_() const noexcept;
554#ifndef DOXYGEN_SHOULD_SKIP_THIS
555 GUM_SHARED_PUBLIC std::string _createMsg_(std::string_view filename,
556 std::string_view function,
558 std::string_view msg);
624 "The Schedule MultiDim Table is abstract")
628 "The Schedule MultiDim Table is unknown")
632 "There exists another identical Schedule MultiDim Table")
638 "The Schedule operation is unknown")
642 "The Schedule operation is not available yet")
646 "The Schedule operation has not been executed yet")
650 "Several evidence/CPT are incompatible together (proba=0)")
668 "Possible incompatibility between score and prior")
682 std::string filename_;
686 std::string aFilename,
689 const std::string& aType =
"Syntax Error");
700#ifndef DOXYGEN_SHOULD_SKIP_THIS
701# ifndef GUM_NO_INLINE
Exception : The Schedule MultiDim Table is abstract.
Exception base for argument error.
Exception base for CPT error.
Error: An unknown error occurred while accessing a database.
Exception : default in label.
Exception : a similar element already exists.
Exception : a similar label already exists.
Exception : There exists another identical Schedule MultiDim Table.
Exception(std::string_view aMsg="", std::string_view aType="Generic error")
~Exception() override=default
Exception(const Exception &e)
GUM_NODISCARD std::string errorCallStack() const
Returns the error call stack.
GUM_NODISCARD std::string errorContent() const
Returns the message content.
GUM_NODISCARD const char * what() const noexcept override
GUM_NODISCARD std::string errorType() const
Returns the error type.
Exception base for factory error.
Exception : invalid state error.
Exception : fatal (unknown ?) error.
Exception base for graph error.
Exception : "hedge" (witness of non-identifiability) is detected in do-calculus / ID computations.
Exception : input/output problem.
Exception : several evidence are incompatible together (proba=0).
Error: The score already contains a different 'implicit' prior.
Exception : there is something wrong with an arc.
Exception: at least one argument passed to a function is not what was expected.
Exception: the number of arguments passed to a function is not what was expected.
Exception : existence of a directed cycle in a graph.
Exception : there is something wrong with an edge.
Exception : node does not exist.
Error: The database contains some missing values.
Error: A name of variable is not found in the database.
Exception : no child for a given node was found.
Exception : no neighbour to a given node was found.
Exception : no parent for a given node was found.
Exception : the element we looked for cannot be found.
Exception : there is something wrong with an implementation.
Exception : a pointer or a reference on a nullptr (0) object.
Exception : operation not allowed.
Exception : out of bound.
Exception : wrong subtype or subclass.
Error: Due to its weight, the prior is currently compatible with the score but if you change the weig...
Exception base for ScheduleMultiDim errors.
Exception base for ScheduleOperator errors.
Exception : problem with size.
Special exception for syntax errors in files.
Exception : wrong type for this operation.
Exception : The Schedule Operation is not available yet.
Exception : a looked-for element could not be found.
Exception : iterator does not point to any valid key.
Exception : generic error on iterator.
Exception : The Schedule Operation has not been executed yet.
Error: An unknown label is found in the database.
Exception : The Schedule MultiDim Table is unknown.
Exception : The Schedule Operation is unknown.
Exception: wrong PRMClassElement for this operation.
#define GUM_MAKE_ERROR(TYPE, SUPERCLASS, MSG)
gum is the global namespace for all aGrUM entities
Provides basic types used in aGrUM.