ATLAS Offline Software
Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
14 #include "CxxUtils/exctrace.h"
15 #include "GaudiKernel/System.h"
16 #include <format>
17 #include <sstream>
18 #include <iostream>
19 
20 namespace AthenaPoolCnvSvc {
21 
22 
24 std::string excNoDictForClass_format (const std::type_info& ti)
25 {
26  return std::string("AthenaPoolCnvSvc::::ExcNoDictForClass: "
27  "Can't find dictionary information for class: ") +
29 }
30 
31 
36 ExcNoDictForClass::ExcNoDictForClass (const std::type_info& ti)
37  : std::runtime_error (excNoDictForClass_format (ti))
38 {
39 }
40 
41 
46 void throwExcNoDictForClass (const std::type_info& ti)
47 {
48  throw ExcNoDictForClass (ti);
49 }
50 
51 
52 //*************************************************************************
53 
54 
56 std::string excUnsupportedVersion_format (const std::type_info& ti,
57  const Guid& guid)
58 {
59  return std::string("AthenaPoolCnvSvc::::ExcUnsupportedVersion: "
60  "Unsupported persistent version of ") +
61  System::typeinfoName(ti) + " found; guid: " + guid.toString();
62 }
63 
64 
71  const Guid& guid)
72  : std::runtime_error (excUnsupportedVersion_format (ti, guid))
73 {
74 }
75 
76 
82 void throwExcUnsupportedVersion (const std::type_info& ti, const Guid& guid)
83 {
84  throw ExcUnsupportedVersion (ti, guid);
85 }
86 
87 
88 //*************************************************************************
89 
90 
92 std::string excCaughtException_format (const char* fnname,
93  const char* action,
94  const std::exception& ex,
95  const std::type_info& ti,
96  const std::string& key)
97 {
98  return std::format("AthenaPoolCnvSvc::::ExcCaughtException: Caught exception in {} while {}{}/{}: {}: {}",
99  fnname, action, System::typeinfoName(ti), key,
100  System::typeinfoName(typeid(ex)), ex.what());
101 }
102 
103 
113  const char* action,
114  const std::exception& ex,
115  const std::type_info& ti,
116  const std::string& key)
117  : std::runtime_error (excCaughtException_format (fnname, action, ex, ti, key))
118 {
119 }
120 
121 
132 void throwExcCaughtException (const char* fnname,
133  const char* action,
134  const std::exception& ex,
135  const std::type_info& ti,
136  const std::string& key)
137 {
138  std::cout.flush();
139  std::cerr.flush();
140  CxxUtils::exctrace (ex);
141  throw ExcCaughtException (fnname, action, ex, ti, key);
142 }
143 
144 
145 } // 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:24
vtune_athena.format
format
Definition: vtune_athena.py:14
AthenaPoolCnvSvc::throwExcUnsupportedVersion
void throwExcUnsupportedVersion(const std::type_info &ti, const Guid &guid)
Throw a AthenaPoolCnvSvc::ExcUnsupportedVersion exception.
Definition: Database/AthenaPOOL/AthenaPoolCnvSvc/src/exceptions.cxx:82
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:132
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:36
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:112
calibdata.exception
exception
Definition: calibdata.py:495
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:92
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:56
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:46
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition: Guid.h:24
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:70
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