API refactor to make fault handling easy

This commit is contained in:
tqchen
2015-07-04 18:12:44 -07:00
parent 4d436a3cb0
commit cc767add88
6 changed files with 725 additions and 394 deletions

View File

@@ -12,6 +12,7 @@
#include <string>
#include <cstdlib>
#include <vector>
#include <stdexcept>
#ifndef XGBOOST_STRICT_CXX98_
#include <cstdarg>
@@ -73,8 +74,7 @@ inline void HandleAssertError(const char *msg) {
* \param msg error message
*/
inline void HandleCheckError(const char *msg) {
fprintf(stderr, "%s\n", msg);
exit(-1);
throw std::runtime_error(msg);
}
inline void HandlePrint(const char *msg) {
printf("%s", msg);