[mlpack] 22/40: Better error output for ARFF.
Barak A. Pearlmutter
barak+git at pearlmutter.net
Mon Feb 15 19:34:24 UTC 2016
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to branch master
in repository mlpack.
commit f490ec5e2a1b7133e4f096c8ea9fbcd8bc58ded9
Author: Ryan Curtin <ryan at ratml.org>
Date: Fri Jan 29 08:22:22 2016 -0800
Better error output for ARFF.
It wasn't properly printing the error for missing values.
---
src/mlpack/core/data/load_arff_impl.hpp | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/mlpack/core/data/load_arff_impl.hpp b/src/mlpack/core/data/load_arff_impl.hpp
index f1f8f78..daee955 100644
--- a/src/mlpack/core/data/load_arff_impl.hpp
+++ b/src/mlpack/core/data/load_arff_impl.hpp
@@ -17,6 +17,8 @@
// In case it hasn't been included yet.
#include "load_arff.hpp"
+#include <boost/algorithm/string.hpp>
+
namespace mlpack {
namespace data {
@@ -188,11 +190,14 @@ void LoadARFF(const std::string& filename,
// Okay, it's not NaN or inf. If it's '?', we issue a specific
// error, otherwise we issue a general error.
std::stringstream error;
- if (token.str() == "?")
- error << "missing values ('?') not supported ";
+ std::string tokenStr = token.str();
+ boost::trim(tokenStr);
+ if (tokenStr == "?")
+ error << "Missing values ('?') not supported, ";
else
- error << "parse error ";
- error << "at line " << (headerLines + row) << " token " << col;
+ error << "Parse error ";
+ error << "at line " << (headerLines + row) << " token " << col
+ << ": \"" << tokenStr << "\".";
throw std::runtime_error(error.str());
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git
More information about the debian-science-commits
mailing list