00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "PSEnv/Exceptions.h"
00017
00018
00019
00020
00021 #include <cxxabi.h>
00022 #include <stdlib.h>
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 namespace {
00033
00034 std::string typeName(const std::type_info& typeinfo)
00035 {
00036 int status;
00037 char* realname = abi::__cxa_demangle(typeinfo.name(), 0, 0, &status);
00038 std::string name = realname;
00039 free(realname);
00040 return name;
00041 }
00042
00043 }
00044
00045
00046
00047
00048
00049 namespace PSEnv {
00050
00051 Exception::Exception( const ErrSvc::Context& ctx, const std::string& what )
00052 : ErrSvc::Issue( ctx, "PSEnv::Exception: " + what )
00053 {
00054 }
00055
00056 ExceptionEpicsName::ExceptionEpicsName ( const ErrSvc::Context& ctx,
00057 const std::string& pvname )
00058 : Exception( ctx, "unknown EPICS PV name: " + pvname)
00059 {
00060 }
00061
00062 ExceptionEpicsConversion::ExceptionEpicsConversion ( const ErrSvc::Context& ctx,
00063 const std::string& pvname,
00064 const std::type_info& ti,
00065 const std::string& what)
00066 : Exception( ctx, "error converting PV value: PV=" + pvname +
00067 ", result type=" + ::typeName(ti) + ", error: " + what )
00068 {
00069 }
00070
00071 }