Last change
on this file since 2328 was
1622,
checked in by oabramkina, 6 years ago
|
Exception handling on trunk.
To activate it, compilation flag -DXIOS_EXCEPTION should be added.
|
-
Property copyright set to
Software name : XIOS (Xml I/O Server) http://forge.ipsl.jussieu.fr/ioserver Creation date : January 2009 Licence : CeCCIL version2 see license file in root directory : Licence_CeCILL_V2-en.txt or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement) CNRS/IPSL (Institut Pierre Simon Laplace) Project Manager : Yann Meurdesoif yann.meurdesoif@cea.fr
|
File size:
1.7 KB
|
Rev | Line | |
---|
[219] | 1 | #include "exception.hpp" |
---|
| 2 | |
---|
| 3 | /// boost headers /// |
---|
| 4 | #include <boost/cast.hpp> |
---|
[497] | 5 | #include "client.hpp" |
---|
| 6 | #include "server.hpp" |
---|
[523] | 7 | #include "log.hpp" |
---|
[219] | 8 | |
---|
[335] | 9 | namespace xios |
---|
[219] | 10 | { |
---|
| 11 | /// ////////////////////// Définitions ////////////////////// /// |
---|
| 12 | CException::CException(void) |
---|
[1622] | 13 | : CObject(), desc_rethrow(true), stream() |
---|
[219] | 14 | { /* Ne rien faire de plus */ } |
---|
| 15 | |
---|
[1622] | 16 | CException::CException(const std::string & id) |
---|
| 17 | : CObject(id), desc_rethrow(true), stream() |
---|
[219] | 18 | { /* Ne rien faire de plus */ } |
---|
| 19 | |
---|
| 20 | CException::CException(const CException & exception) |
---|
[1622] | 21 | // : std::basic_ios<char>() |
---|
| 22 | : CObject(exception.getId()) |
---|
| 23 | // , StdOStringStream() |
---|
| 24 | // , desc_rethrow(false) |
---|
[219] | 25 | { (*this) << exception.str(); } |
---|
| 26 | |
---|
| 27 | CException::~CException(void) |
---|
[497] | 28 | { |
---|
[1622] | 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 |
---|
[278] | 41 | } |
---|
[219] | 42 | |
---|
| 43 | //--------------------------------------------------------------- |
---|
| 44 | |
---|
[1622] | 45 | std::string CException::getMessage(void) const |
---|
[219] | 46 | { |
---|
[1622] | 47 | // StdOStringStream oss; |
---|
| 48 | // oss << "> Error [" << this->getId() << "] : " << this->str(); |
---|
| 49 | // return (oss.str()); |
---|
| 50 | return (stream.str()); |
---|
[219] | 51 | } |
---|
| 52 | |
---|
| 53 | StdOStringStream & CException::getStream(void) |
---|
[1622] | 54 | // { return (*boost::polymorphic_cast<StdOStringStream*>(this)); } |
---|
| 55 | { return stream; } |
---|
[219] | 56 | |
---|
[1622] | 57 | std::string CException::toString(void) const |
---|
| 58 | // { return (std::string(this->getMessage())); } |
---|
| 59 | { return stream.str(); } |
---|
[219] | 60 | |
---|
[1622] | 61 | void CException::fromString(const std::string & str) |
---|
| 62 | { } |
---|
| 63 | // { this->str(str); } |
---|
[219] | 64 | |
---|
| 65 | //--------------------------------------------------------------- |
---|
| 66 | |
---|
[335] | 67 | } // namespace xios |
---|
Note: See
TracBrowser
for help on using the repository browser.