ATLAS Offline Software
Loading...
Searching...
No Matches
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
11
12
14#include "CxxUtils/exctrace.h"
15#include "GaudiKernel/System.h"
16#include <format>
17#include <sstream>
18#include <iostream>
19
20namespace AthenaPoolCnvSvc {
21
22
24std::string excNoDictForClass_format (const std::type_info& ti)
25{
26 return std::string("AthenaPoolCnvSvc::::ExcNoDictForClass: "
27 "Can't find dictionary information for class: ") +
28 System::typeinfoName(ti);
29}
30
31
40
41
46void throwExcNoDictForClass (const std::type_info& ti)
47{
48 throw ExcNoDictForClass (ti);
49}
50
51
52//*************************************************************************
53
54
56std::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)
73{
74}
75
76
82void throwExcUnsupportedVersion (const std::type_info& ti, const Guid& guid)
83{
84 throw ExcUnsupportedVersion (ti, guid);
85}
86
87
88//*************************************************************************
89
90
92std::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
132void 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();
141 throw ExcCaughtException (fnname, action, ex, ti, key);
142}
143
144
145} // namespace AthenaPoolCnvSvc
Exceptions that can be thrown from AthenaPoolCnvSvc.
ExcCaughtException(const char *fnname, const char *action, const std::exception &ex, const std::type_info &ti, const std::string &key)
Constructor.
ExcUnsupportedVersion(const std::type_info &ti, const Guid &guid)
Constructor.
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition Guid.h:25
STL class.
Generate stack trace backs from a caught exception.
void throwExcUnsupportedVersion(const std::type_info &ti, const Guid &guid)
Throw a AthenaPoolCnvSvc::ExcUnsupportedVersion exception.
void throwExcNoDictForClass(const std::type_info &ti)
Throw a AthenaPoolCnvSvc::ExcNoDictForClass exception.
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.
std::string excUnsupportedVersion_format(const std::type_info &ti, const Guid &guid)
Helper: format exception error string.
std::string excNoDictForClass_format(const std::type_info &ti)
Helper: format exception error string.
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.
void exctrace(const std::exception &e, IOFD fd=IOFD_INVALID)
Print out information for the last exception.
Definition exctrace.cxx:59
STL namespace.