47#ifndef GUM_EXCEPTIONS_H
48#define GUM_EXCEPTIONS_H
59#define GUM_ERROR_IN_EXPR(type, msg) throw(type(msg))
61#if defined(SWIG) || defined(GUM_FOR_SWIG)
63# define GUM_ERROR(type, msg) \
65 std::ostringstream err_stream; \
67 throw(type(err_stream.str())); \
69# define GUM_SHOWERROR(e) \
70 { std::cout << std::endl << (e).what() << std::endl; }
72# define GUM_ERROR(type, msg) \
74 std::ostringstream error_stream; \
75 error_stream << msg; \
76 throw(type(gum::_createMsg_(__FILE__, __FUNCTION__, __LINE__, error_stream.str()))); \
79# define GUM_SHOWERROR(e) \
81 std::cout << std::endl << __FILE__ << ":" << __LINE__ << " " << (e).what() << std::endl; \
82 std::cout << (e).errorCallStack() << std::endl; \
85# define GUM_SHOWERROR(e) \
86 { std::cout << std::endl << __FILE__ << ":" << __LINE__ << " " << (e).what() << std::endl; }
90#define GUM_MAKE_ERROR(TYPE, SUPERCLASS, MSG) \
91 class TYPE: public SUPERCLASS { \
93 explicit TYPE(const std::string& aMsg, const std::string& aType = MSG) : \
94 SUPERCLASS(aMsg, aType) {}; \
95 TYPE(const TYPE& src) : SUPERCLASS(src) {}; \
99# define GUM_SYNTAX_ERROR(msg, filename, line, column) \
101 std::ostringstream error_stream; \
102 error_stream << msg; \
103 throw(gum::SyntaxError(error_stream.str(), filename, line, column)); \
106# define GUM_SYNTAX_ERROR(msg, filename, line, column) \
108 std::ostringstream error_stream; \
109 error_stream << msg; \
110 throw(gum::SyntaxError(error_stream.str(), filename, line, column)); \
130 explicit Exception(std::string aMsg =
"", std::string aType =
"Generic error");
519#ifndef DOXYGEN_SHOULD_SKIP_THIS
520 std::string _createMsg_(
const std::string& filename,
521 const std::string& function,
523 const std::string& msg);
587 "The Schedule MultiDim Table is abstract")
591 "The Schedule MultiDim Table is unknown")
595 "There exists another identical Schedule MultiDim Table")
601 "The Schedule operation is unknown")
605 "The Schedule operation is not available yet")
609 "The Schedule operation has not been executed yet")
613 "Several evidence/CPT are incompatible together (proba=0)")
631 "Possible incompatibility between score and prior")
645 std::string filename_;
649 std::string aFilename,
652 const std::string& aType =
"Syntax Error") :
653 IOError(aMsg, aType), noLine_(nol), noCol_(noc), filename_(
std::move(aFilename)) {
657 std::ostringstream error_stream;
658 error_stream <<
type_ <<
":" << std::endl;
659 error_stream << filename() <<
":" << line() <<
"," << col() <<
" : " <<
msg_;
660 what_ = error_stream.str();
668 GUM_NODISCARD std::string filename()
const {
return filename_; };
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.
virtual ~Exception()=default
GUM_NODISCARD const char * what() const noexcept override
GUM_NODISCARD std::string errorType() const
Returns the error type.
GUM_NODISCARD std::string errorCallStack() const
Returns the error call stack.
Exception(std::string aMsg="", std::string aType="Generic error")
GUM_NODISCARD std::string errorContent() const
Returns the message content.
Exception(const Exception &e)
Exception base for factory error.
Exception : invalid state error.
Exception : fatal (unknown ?) error.
Exception base for graph error.
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)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
gum is the global namespace for all aGrUM entities
Provides basic types used in aGrUM.