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/server/exception.H>
00027
00028 #include <archon/x3d/sai/exception.H>
00029 #include <archon/x3d/sai/sai.H>
00030
00031 namespace Archon
00032 {
00033 namespace X3D
00034 {
00035 namespace SAI
00036 {
00037 using namespace std;
00038 using namespace Utilities;
00039
00040 bool exceptionCatchInfo(Exception::Formatter format, string &result)
00041 {
00042 try { throw; }
00043 catch(x3d::sai::ServerErrorException &e)
00044 {
00045 result = (*format)(typeid(e), "", "'" + string(e.message) + "'");
00046 }
00047 catch(x3d::sai::ApplicationErrorException &e)
00048 {
00049 result = (*format)(typeid(e), "", string(e.message));
00050 }
00051 catch(x3d::sai::FileRequestException &e)
00052 {
00053 result = (*format)(typeid(e), "", string(e.message));
00054 }
00055 catch(x3d::sai::StreamReadException &e)
00056 {
00057 result = (*format)(typeid(e), "", string(e.message));
00058 }
00059 catch(omniORB::fatalException &e)
00060 {
00061 result = (*format)(typeid(e), string(e.file()) + ":" +
00062 Text::toString(e.line()), e.errmsg());
00063 }
00064 catch(CORBA::Exception &e)
00065 {
00066 result = (*format)(typeid(e), "", "");
00067 }
00068 catch(...)
00069 {
00070 return X3D::exceptionCatchInfo(format, result);
00071 }
00072 return true;
00073 }
00074
00075 string exceptionCatchShortExplanation()
00076 {
00077 string message;
00078 if(!exceptionCatchInfo(&Exception::explainShort, message))
00079 message = Exception::explainShortUnknown();
00080 return message;
00081 }
00082 }
00083 }
00084 }
00085