From: Ivan Vagin/AI Tools Lab /SRR/Engineer/삼성전자 Date: Wed, 27 Jun 2018 07:18:04 +0000 (+0300) Subject: [foundation] Implemented 'Exception' class 'what()' method (#351) X-Git-Tag: nncc_backup~2562 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a0e42b5036fb2d6c41bcce114ca697b6d2f285e;p=platform%2Fcore%2Fml%2Fnnfw.git [foundation] Implemented 'Exception' class 'what()' method (#351) Implemented 'Exception' class 'what()' method This commit introduced 'what()' method 'Exception' class Signed-off-by: Ivan Vagin --- diff --git a/libs/foundation/include/nncc/foundation/Exception.h b/libs/foundation/include/nncc/foundation/Exception.h index 1238b1d..ae68e34 100644 --- a/libs/foundation/include/nncc/foundation/Exception.h +++ b/libs/foundation/include/nncc/foundation/Exception.h @@ -29,6 +29,7 @@ public: private: std::vector _info; + mutable std::string _sInfo; }; std::ostream &operator<<(std::ostream &s, const Exception &e); diff --git a/libs/foundation/src/Exception.cpp b/libs/foundation/src/Exception.cpp index c677bba..8cdfcb6 100644 --- a/libs/foundation/src/Exception.cpp +++ b/libs/foundation/src/Exception.cpp @@ -26,8 +26,10 @@ Exception::Exception(Exception &e, const std::string &info) const char *Exception::what() const throw() { - // TODO implement it - throw std::runtime_error{"Not implemented, yet"}; + _sInfo.clear(); + for (auto it : _info) + _sInfo.append(it).append("\n"); + return _sInfo.c_str(); } const std::vector &Exception::getInfo() const { return _info; }