25 #ifndef GUM_EXCEPTIONS_H 26 #define GUM_EXCEPTIONS_H 36 #define GUM_ERROR_IN_EXPR(type, msg) throw(type(msg)) 39 # define GUM_ERROR(type, msg) \ 41 std::ostringstream __error__str; \ 42 __error__str << msg; \ 43 throw(type(__error__str.str())); \ 45 # define GUM_SHOWERROR(e) \ 47 std::cout << std::endl \ 48 << (e).errorType() << " : " << (e).errorContent() << std::endl; \ 51 # ifndef GUM_DEBUG_MODE 52 # define GUM_ERROR(type, msg) \ 54 std::ostringstream __error__str; \ 55 __error__str << __FILE__ << ":" << __LINE__ << ": " << msg; \ 56 throw(type(__error__str.str())); \ 58 # define GUM_SHOWERROR(e) \ 60 std::cout << std::endl \ 61 << __FILE__ << ":" << __LINE__ << " " << (e).errorType() \ 62 << " from " << std::endl \ 63 << (e).errorContent() << std::endl; \ 66 # define GUM_ERROR(type, msg) \ 68 std::ostringstream __error__str; \ 69 __error__str << msg; \ 70 throw(type(gum::__createMsg( \ 71 __FILE__, __FUNCTION__, __LINE__, __error__str.str()))); \ 73 # define GUM_SHOWERROR(e) \ 75 std::cout << std::endl \ 76 << __FILE__ << ":" << __LINE__ << " " << (e).errorType() \ 77 << " from " << std::endl \ 78 << (e).errorContent() << std::endl; \ 79 std::cout << (e).errorCallStack() << std::endl; \ 81 # endif // GUM_DEBUG_MODE 84 #define GUM_MAKE_ERROR(TYPE, SUPERCLASS, MSG) \ 85 class TYPE : public SUPERCLASS { \ 87 TYPE(std::string aMsg, std::string aType = MSG) : SUPERCLASS(aMsg, aType){}; \ 88 TYPE(const TYPE& src) : SUPERCLASS(src){}; \ 91 #define GUM_SYNTAX_ERROR(msg, line, column) \ 93 std::ostringstream __error__str; \ 94 __error__str << msg; \ 95 throw(gum::SyntaxError(__error__str.str(), line, column)); \ 115 const std::string aType =
"Generic error");
123 const std::string
what()
const {
return "[pyAgrum] " + _type +
": " +
_msg; }
125 const std::string
what()
const {
return "[pyAgrum] " + _type +
" : " +
_msg; }
483 #ifndef DOXYGEN_SHOULD_SKIP_THIS 484 const std::string __createMsg(
const std::string& filename,
485 const std::string&
function,
487 const std::string& msg);
523 "several evidence/CPT are incompatible together (proba=0)")
532 "Incompatbile (maybe implicit) priors")
535 "Possible incompatibilty between score and prior")
539 "Missing variable name in database")
542 "The database contains some missing values")
545 "Unknown label found in database")
556 std::string aType =
"Syntax Error") :
557 IOError(aMsg, aType),
558 _noLine(nol), _noCol(noc){
562 Size col()
const {
return _noCol; };
563 Size line()
const {
return _noLine; };
565 #endif // DOXYGEN_SHOULD_SKIP_THIS
#define GUM_MAKE_ERROR(TYPE, SUPERCLASS, MSG)
const std::string errorCallStack() const
Returns the error call stack.
Provides basic types used in aGrUM.
const std::string errorType() const
Returns the error type.
Exception : several evidence are incompatible together (proba=0)
gum is the global namespace for all aGrUM entities
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.