23 #include <openbabel/babelconfig.h> 57 OBError(
const std::string &method =
"",
58 const std::string &errorMsg =
"",
59 const std::string &explanation =
"",
60 const std::string &possibleCause =
"",
61 const std::string &suggestedRemedy =
"",
65 std::string message(
void)
const;
75 std::string
GetError()
const {
return _errorMsg; }
110 unsigned int _messageCount[5];
119 void ThrowError(
const std::string &method,
const std::string &errorMsg,
123 std::vector<std::string> GetMessagesOfLevel(
const obMessageLevel);
148 bool StartErrorWrap();
150 bool StopErrorWrap();
163 std::string GetMessageSummary();
211 obErrorLog.ThrowError(
"", str(),
obInfo);
bool _logging
Whether messages will be logged into _messageList.
Definition: oberror.h:176
int sync()
Call OBMessageHandler::ThrowError() and flush the buffer.
Definition: oberror.h:209
std::string GetError() const
Definition: oberror.h:75
for critical errors (e.g., cannot read a file)
Definition: oberror.h:40
std::streambuf * _filterStreamBuf
The filtered obLogBuf stream buffer to wrap error messages.
Definition: oberror.h:183
unsigned int GetErrorMessageCount()
Definition: oberror.h:153
std::string _errorMsg
The actual error message.
Definition: oberror.h:92
obMessageLevel GetOutputLevel()
Definition: oberror.h:142
std::ostream * _outputStream
Definition: oberror.h:173
OBMessageHandler obErrorLog
Global OBMessageHandler error handler.
Definition: oberror.h:187
std::string message(void) const
Definition: oberror.cpp:46
Handle error messages, warnings, debugging information and the like.
Definition: oberror.h:106
unsigned int _maxEntries
The maximum size of _messageList log.
Definition: oberror.h:178
Customizable error handling and logging – store a message, including the method yielding the error...
Definition: oberror.h:52
std::deque< OBError > _messageList
Log of messages for later retrieval via GetMessagesOfLevel()
Definition: oberror.h:167
obMessageLevel
Levels of error and audit messages to allow filtering.
Definition: oberror.h:39
std::string GetPossibleCause() const
Definition: oberror.h:79
for non-critical problems (e.g., molecule appears empty)
Definition: oberror.h:41
void ThrowError(char *str)
Definition: obutil.cpp:55
for messages only useful for debugging purposes
Definition: oberror.h:44
obMessageLevel _outputLevel
Filtering level for messages and logging (messages of lower priority will be ignored.
Definition: oberror.h:170
std::string _explanation
Optional explanation message: more detailed than the brief error.
Definition: oberror.h:94
std::string GetExplanation() const
Definition: oberror.h:77
std::streambuf * _inWrapStreamBuf
The default stream buffer for the output stream (saved if wrapping is ued)
Definition: oberror.h:181
errorQualifier
Definition: oberror.h:47
void StartLogging()
Start logging messages (default)
Definition: oberror.h:126
for messages auditing methods which destroy or perceive molecular data (e.g., kekulization, atom typing, etc.)
Definition: oberror.h:43
unsigned int GetAuditMessageCount()
Definition: oberror.h:159
unsigned int GetDebugMessageCount()
Definition: oberror.h:161
std::ostream * GetOutputStream()
Definition: oberror.h:145
virtual ~obLogBuf()
Close the output buffer, flush, and call OBMessageHandler::ThrowError()
Definition: oberror.h:205
std::string GetSuggestedRemedy() const
Definition: oberror.h:81
unsigned int GetInfoMessageCount()
Definition: oberror.h:157
void SetOutputStream(std::ostream *os)
Definition: oberror.h:144
void StopLogging()
Stop logging messages completely.
Definition: oberror.h:128
void ClearLog()
Clear the current message log entirely.
Definition: oberror.h:136
void SetMaxLogEntries(unsigned int max)
Set the maximum number of entries (or 0 for no limit)
Definition: oberror.h:131
std::ostream & operator<<(std::ostream &, const vector3 &)
Prints a representation of the vector as a row vector of the form "<0.1,1,2>".
Definition: vector3.cpp:109
std::string GetMethod() const
Definition: oberror.h:73
unsigned int GetWarningMessageCount()
Definition: oberror.h:155
obMessageLevel GetLevel() const
Definition: oberror.h:83
std::string _method
The method causing the error (typically from the compiler macro FUNCTION)
Definition: oberror.h:90
std::string _possibleCause
Optional cause message.
Definition: oberror.h:96
for informative messages (e.g., file is a non-standard format)
Definition: oberror.h:42
A minimal streambuf derivative to wrap calls to cerr into calls to OBMessageHandler as needed...
Definition: oberror.h:201
unsigned int GetMaxLogEntries()
Definition: oberror.h:133
std::string _suggestedRemedy
Optional workaround or remedy.
Definition: oberror.h:98
void SetOutputLevel(const obMessageLevel level)
Set the level of messages to output (i.e., messages with at least this priority will be output) ...
Definition: oberror.h:140
obMessageLevel _level
The severity level: used for filtering via OBMessageHandler.
Definition: oberror.h:101
bool operator==(const OBBitVec &bv1, const OBBitVec &bv2)
Definition: bitvec.cpp:525
Global namespace for all Open Babel code.
Definition: alias.h:22