Changeset 1612 for XIOS/dev/dev_olga/src/exception.cpp
- Timestamp:
- 11/23/18 14:48:14 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/exception.cpp
r828 r1612 5 5 #include "client.hpp" 6 6 #include "server.hpp" 7 #include "cxios.hpp"8 7 #include "log.hpp" 9 8 … … 12 11 /// ////////////////////// Définitions ////////////////////// /// 13 12 CException::CException(void) 14 : CObject(), desc_rethrow(true) 13 : CObject(), desc_rethrow(true), stream() 15 14 { /* Ne rien faire de plus */ } 16 15 17 CException::CException(const StdString & id)18 : CObject(id), desc_rethrow(true) 16 CException::CException(const std::string & id) 17 : CObject(id), desc_rethrow(true), stream() 19 18 { /* Ne rien faire de plus */ } 20 19 21 20 CException::CException(const CException & exception) 22 : std::basic_ios<char>()23 ,CObject(exception.getId())24 , StdOStringStream()25 , desc_rethrow(false)21 // : std::basic_ios<char>() 22 : CObject(exception.getId()) 23 // , StdOStringStream() 24 // , desc_rethrow(false) 26 25 { (*this) << exception.str(); } 27 26 28 27 CException::~CException(void) 29 28 { 30 if (desc_rethrow) 31 #ifdef __XIOS_NOABORT 32 { 33 throw (*this); 34 } 35 #else 36 { 37 error << this->getMessage() << std::endl; 38 MPI_Abort(CXios::globalComm, -1); //abort(); 39 } 40 #endif 29 // if (desc_rethrow) 30 //#ifdef __XIOS_NOABORT 31 // { 32 // throw (*this); 33 // } 34 //#else 35 // { 36 // error << this->getMessage() << std::endl; 37 // throw 4; 38 // MPI_Abort(CXios::globalComm, -1); //abort(); 39 // } 40 //#endif 41 41 } 42 42 43 43 //--------------------------------------------------------------- 44 44 45 StdString CException::getMessage(void) const45 std::string CException::getMessage(void) const 46 46 { 47 StdOStringStream oss; 48 oss << "> Error [" << this->getId() << "] : " << this->str(); 49 return (oss.str()); 47 // StdOStringStream oss; 48 // oss << "> Error [" << this->getId() << "] : " << this->str(); 49 // return (oss.str()); 50 return (stream.str()); 50 51 } 51 52 52 53 StdOStringStream & CException::getStream(void) 53 { return (*boost::polymorphic_cast<StdOStringStream*>(this)); } 54 // { return (*boost::polymorphic_cast<StdOStringStream*>(this)); } 55 { return stream; } 54 56 55 StdString CException::toString(void) const 56 { return (StdString(this->getMessage())); } 57 std::string CException::toString(void) const 58 // { return (std::string(this->getMessage())); } 59 { return stream.str(); } 57 60 58 void CException::fromString(const StdString & str) 59 { this->str(str); } 61 void CException::fromString(const std::string & str) 62 { } 63 // { this->str(str); } 60 64 61 65 //---------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.