28 #ifndef GUM_EXCEPTIONS_H 29 #define GUM_EXCEPTIONS_H 39 #define GUM_ERROR_IN_EXPR(type, msg) throw(type(msg)) 42 # define GUM_ERROR(type, msg) \ 44 std::ostringstream __error__str; \ 45 __error__str << msg; \ 46 throw(type(__error__str.str())); \ 48 # define GUM_SHOWERROR(e) \ 50 std::cout << std::endl \ 51 << (e).errorType() << " : " << (e).errorContent() << std::endl; \ 54 # ifndef GUM_DEBUG_MODE 55 # define GUM_ERROR(type, msg) \ 57 std::ostringstream __error__str; \ 58 __error__str << __FILE__ << ":" << __LINE__ << ": " << msg; \ 59 throw(type(__error__str.str())); \ 61 # define GUM_SHOWERROR(e) \ 63 std::cout << std::endl \ 64 << __FILE__ << ":" << __LINE__ << " " << (e).errorType() \ 65 << " from " << std::endl \ 66 << (e).errorContent() << std::endl; \ 68 # else // GUM_FOR_SWIG 69 # define GUM_ERROR(type, msg) \ 71 std::ostringstream __error__str; \ 72 __error__str << msg; \ 73 throw(type(gum::__createMsg( \ 74 __FILE__, __FUNCTION__, __LINE__, __error__str.str()))); \ 76 # define GUM_SHOWERROR(e) \ 78 std::cout << std::endl \ 79 << __FILE__ << ":" << __LINE__ << " " << (e).errorType() \ 80 << " from " << std::endl \ 81 << (e).errorContent() << std::endl; \ 82 std::cout << (e).errorCallStack() << std::endl; \ 84 # endif // GUM_DEBUG_MODE 85 #endif // GUM_FOR_SWIG 87 #define GUM_MAKE_ERROR(TYPE, SUPERCLASS, MSG) \ 88 class TYPE: public SUPERCLASS { \ 90 TYPE(std::string aMsg, std::string aType = MSG) : SUPERCLASS(aMsg, aType){}; \ 91 TYPE(const TYPE& src) : SUPERCLASS(src){}; \ 94 #define GUM_SYNTAX_ERROR(msg, line, column) \ 96 std::ostringstream __error__str; \ 97 __error__str << msg; \ 98 throw(gum::SyntaxError(__error__str.str(), line, column)); \ 118 const std::string aType =
"Generic error");
126 const std::string
what()
const {
return "[pyAgrum] " + _type +
": " +
_msg; }
127 #else // GUM_FOR_SWIG 128 const std::string
what()
const {
return _type +
" : " +
_msg; }
129 #endif // GUM_FOR_SWIG 486 #ifndef DOXYGEN_SHOULD_SKIP_THIS 487 const std::string __createMsg(
const std::string& filename,
488 const std::string&
function,
490 const std::string& msg);
526 "several evidence/CPT are incompatible together (proba=0)")
535 "Incompatbile (maybe implicit) priors")
538 "Possible incompatibilty between score and prior")
542 "Missing variable name in database")
545 "The database contains some missing values")
548 "Unknown label found in database")
559 std::string aType =
"Syntax Error") :
560 IOError(aMsg, aType),
561 _noLine(nol), _noCol(noc){
565 Size col()
const {
return _noCol; };
566 Size line()
const {
return _noLine; };
568 #endif // DOXYGEN_SHOULD_SKIP_THIS
#define GUM_MAKE_ERROR(TYPE, SUPERCLASS, MSG)
const std::string errorCallStack() const
Returns the error call stack.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
const std::string errorType() const
Returns the error type.
Exception : several evidence are incompatible together (proba=0)
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
The base class for all directed edgesThis class is used as a basis for manipulating all directed edge...
Base class for all aGrUM's exceptions.
Exception(const std::string aMsg="", const std::string aType="Generic error")
The base class for all undirected edges.
const std::string what() const
std::size_t Size
In aGrUM, hashed values are unsigned long int.
const std::string errorContent() const
Returns the message content.