diff options
Diffstat (limited to 'util/exception.hh')
-rw-r--r-- | util/exception.hh | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/util/exception.hh b/util/exception.hh index 00207b242..b30183e7f 100644 --- a/util/exception.hh +++ b/util/exception.hh @@ -8,7 +8,7 @@ #include <string> #include <stdint.h> -// TODO(hieu) delete this +// TODO(hieu): delete this #include <sstream> namespace util { @@ -20,7 +20,7 @@ class Exception : public std::exception { Exception() throw(); virtual ~Exception() throw(); - const char *what() const throw() { return what_.c_str(); } + const char *what() const throw() { return what_.str().c_str(); } // For use by the UTIL_THROW macros. void SetLocation( @@ -38,7 +38,7 @@ class Exception : public std::exception { typedef T Identity; }; - std::string what_; + StringStream what_; }; /* This implements the normal operator<< for Exception and all its children. @@ -46,12 +46,10 @@ class Exception : public std::exception { * boost::enable_if. */ template <class Except, class Data> typename Except::template ExceptionTag<Except&>::Identity operator<<(Except &e, const Data &data) { - // TODO(hieu): change this to - // StringStream(e.what_) << data; - + // TODO(hieu): delete this. std::stringstream moses_hack; moses_hack << data; - e.what_ += moses_hack.str(); + e.what_ << moses_hack.str(); return e; } |