00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <iostream>
00021
00022 #include <omniORB4/CORBA.h>
00023
00024 #include <archon/util/text.H>
00025
00026 #include <archon/x3d/proxy/exception.H>
00027 #include <archon/x3d/proxy/sai.H>
00028
00029 namespace Archon
00030 {
00031 namespace X3D
00032 {
00033 namespace Proxy
00034 {
00035 using namespace std;
00036 using namespace Utilities;
00037
00038 bool exceptionCatchInfo(Exception::Formatter format, string &result)
00039 {
00040 try { throw; }
00041 catch(x3d::sai::ServerErrorException &e)
00042 {
00043 result = (*format)(typeid(e), "", "'" + string(e.message) + "'");
00044 }
00045 catch(x3d::sai::ApplicationErrorException &e)
00046 {
00047 result = (*format)(typeid(e), "", string(e.message));
00048 }
00049 catch(x3d::sai::FileRequestException &e)
00050 {
00051 result = (*format)(typeid(e), "", string(e.message));
00052 }
00053 catch(x3d::sai::StreamReadException &e)
00054 {
00055 result = (*format)(typeid(e), "", string(e.message));
00056 }
00057 catch(omniORB::fatalException &e)
00058 {
00059 result = (*format)(typeid(e), string(e.file()) + ":" +
00060 Text::toString(e.line()), e.errmsg());
00061 }
00062 catch(CORBA::Exception &e)
00063 {
00064 result = (*format)(typeid(e), "", "");
00065 }
00066 catch(...)
00067 {
00068 return Utilities::exceptionCatchInfo(format, result);
00069 }
00070 return true;
00071 }
00072
00073 string exceptionCatchShortExplanation()
00074 {
00075 string message;
00076 if(!exceptionCatchInfo(&Exception::explainShort, message))
00077 message = Exception::explainShortUnknown();
00078 return message;
00079 }
00080 }
00081 }
00082 }
00083