ATLAS Offline Software
Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
14 #include "CxxUtils/exctrace.h"
15 #include "GaudiKernel/System.h"
16 #include <sstream>
17 
18 
19 namespace AthenaPoolCnvSvc {
20 
21 
23 std::string excNoDictForClass_format (const std::type_info& ti)
24 {
25  std::ostringstream os;
26  os << "AthenaPoolCnvSvc::::ExcNoDictForClass: "
27  << "Can't find dictionary information for class: ";
28  os << System::typeinfoName(ti);
29  return os.str();
30 }
31 
32 
37 ExcNoDictForClass::ExcNoDictForClass (const std::type_info& ti)
38  : std::runtime_error (excNoDictForClass_format (ti))
39 {
40 }
41 
42 
47 void throwExcNoDictForClass (const std::type_info& ti)
48 {
49  throw ExcNoDictForClass (ti);
50 }
51 
52 
53 //*************************************************************************
54 
55 
57 std::string excUnsupportedVersion_format (const std::type_info& ti,
58  const Guid& guid)
59 {
60  std::ostringstream os;
61  os << "AthenaPoolCnvSvc::::ExcUnsupportedVersion: "
62  << "Unsupported persistent version of "
64  << " found; guid: " << guid.toString();
65  return os.str();
66 }
67 
68 
75  const Guid& guid)
76  : std::runtime_error (excUnsupportedVersion_format (ti, guid))
77 {
78 }
79 
80 
86 void throwExcUnsupportedVersion (const std::type_info& ti, const Guid& guid)
87 {
88  throw ExcUnsupportedVersion (ti, guid);
89 }
90 
91 
92 //*************************************************************************
93 
94 
96 std::string excCaughtException_format (const char* fnname,
97  const char* action,
98  const std::exception& ex,
99  const std::type_info& ti,
100  const std::string& key)
101 {
102  std::ostringstream os;
103  os << "AthenaPoolCnvSvc::::ExcCaughtException: "
104  << "Caught exception in " << fnname
105  << " while " << action
106  << System::typeinfoName(ti) << "/" << key
107  << ": " << System::typeinfoName(typeid(ex)) << ": " << ex.what();
108  return os.str();
109 }
110 
111 
121  const char* action,
122  const std::exception& ex,
123  const std::type_info& ti,
124  const std::string& key)
125  : std::runtime_error (excCaughtException_format (fnname, action, ex, ti, key))
126 {
127 }
128 
129 
140 void throwExcCaughtException (const char* fnname,
141  const char* action,
142  const std::exception& ex,
143  const std::type_info& ti,
144  const std::string& key)
145 {
146  std::cout.flush();
147  std::cerr.flush();
148  CxxUtils::exctrace (ex);
149  throw ExcCaughtException (fnname, action, ex, ti, key);
150 }
151 
152 
153 } // namespace AthenaPoolCnvSvc
AthenaPoolCnvSvc::excNoDictForClass_format
std::string excNoDictForClass_format(const std::type_info &ti)
Helper: format exception error string.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx:23
AthenaPoolCnvSvc::throwExcUnsupportedVersion
void throwExcUnsupportedVersion(const std::type_info &ti, const Guid &guid)
Throw a AthenaPoolCnvSvc::ExcUnsupportedVersion exception.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx:86
exctrace.h
Generate stack trace backs from a caught exception.
AthenaPoolCnvSvc::throwExcCaughtException
void throwExcCaughtException(const char *fnname, const char *action, const std::exception &ex, const std::type_info &ti, const std::string &key)
Throw a AthenaPoolCnvSvc::ExcCaughtException exception.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx:140
AthenaPoolCnvSvc::ExcNoDictForClass
Exception — Can't find dictionary information for class.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/exceptions.h:35
Athena::typeinfoName
std::string typeinfoName(const std::type_info &ti)
Convert a type_info to a demangled string.
Definition: AthenaKernel/src/ClassName.cxx:23
AthenaPoolCnvSvc::ExcNoDictForClass::ExcNoDictForClass
ExcNoDictForClass(const std::type_info &ti)
Constructor.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx:37
AthenaPoolCnvSvc::ExcCaughtException::ExcCaughtException
ExcCaughtException(const char *fnname, const char *action, const std::exception &ex, const std::type_info &ti, const std::string &key)
Constructor.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx:120
calibdata.exception
exception
Definition: calibdata.py:496
AthenaPoolCnvSvc::excCaughtException_format
std::string excCaughtException_format(const char *fnname, const char *action, const std::exception &ex, const std::type_info &ti, const std::string &key)
Helper: format exception error string.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx:96
AthenaPoolCnvSvc::ExcUnsupportedVersion
Exception — Unsupported persistent version of CLASS found.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/exceptions.h:60
AthenaPoolCnvSvc::excUnsupportedVersion_format
std::string excUnsupportedVersion_format(const std::type_info &ti, const Guid &guid)
Helper: format exception error string.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx:57
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
pool_uuid.guid
guid
Definition: pool_uuid.py:112
AthenaPoolCnvSvc::throwExcNoDictForClass
void throwExcNoDictForClass(const std::type_info &ti)
Throw a AthenaPoolCnvSvc::ExcNoDictForClass exception.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx:47
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition: Guid.h:20
python.CaloScaleNoiseConfig.action
action
Definition: CaloScaleNoiseConfig.py:77
AthenaPoolCnvSvc::ExcCaughtException
Exception — Caught an exception during conversion.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/exceptions.h:87
exceptions.h
Exceptions that can be thrown from AthenaPoolCnvSvc.
AthenaPoolCnvSvc::ExcUnsupportedVersion::ExcUnsupportedVersion
ExcUnsupportedVersion(const std::type_info &ti, const Guid &guid)
Constructor.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx:74
CxxUtils::exctrace
void exctrace(const std::exception &e, IOFD fd=IOFD_INVALID)
Print out information for the last exception.
Definition: exctrace.cxx:59
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
AthenaPoolCnvSvc
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/debug.h:26