ATLAS Offline Software
Calorimeter/CaloUtils/src/exceptions.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
3  */
12 #include "CaloUtils/exceptions.h"
13 #include <sstream>
14 
15 
16 namespace CaloUtils {
17 
18 
20 std::string excBadToolConstantVersion_format (const std::string& toolName,
21  const std::string& constName,
22  unsigned int toolVersion,
23  unsigned int constVersion)
24 {
25  std::ostringstream os;
26  os << "ExcBadToolConstantVersion: version mismatch for tool " << toolName
27  << " constant " << constName
28  << " constant version " << constVersion
29  << " is larger than tool version " << toolVersion;
30  return os.str();
31 }
32 
33 
42  (const std::string& toolName,
43  const std::string& constName,
44  unsigned int toolVersion,
45  unsigned int constVersion)
46  : std::runtime_error (excBadToolConstantVersion_format (toolName,
47  constName,
48  toolVersion,
49  constVersion))
50 {
51 }
52 
53 
54 //*************************************************************************
55 
56 
58 std::string excConstantNotSet_format (const std::string& toolName,
59  const std::string& constName)
60 {
61  std::ostringstream os;
62  os << "ExcConstantNotSet: constant " << constName << " in tool " << toolName
63  << " was not set.";
64  return os.str();
65 }
66 
67 
74  (const std::string& toolName,
75  const std::string& constName)
76  : std::runtime_error (excConstantNotSet_format (toolName,
77  constName))
78 {
79 }
80 
81 
82 //*************************************************************************
83 
84 
86 std::string excConstantReset_format (const std::string& toolName,
87  const std::string& constName)
88 {
89  std::ostringstream os;
90  os << "ExcConstantReset: constant " << constName << " in tool " << toolName
91  << " set more than once.";
92  return os.str();
93 }
94 
95 
102  (const std::string& toolName,
103  const std::string& constName)
104  : std::runtime_error (excConstantReset_format (toolName,
105  constName))
106 {
107 }
108 
109 
110 //*************************************************************************
111 
112 
114 std::string excBadContextlessRetrieve_format (const std::string& toolName,
115  const std::string& constName)
116 {
117  std::ostringstream os;
118  os << "ExcBadContextlessRetrieve: constant " << constName << " in tool " << toolName
119  << " bad contextless retrieve.";
120  return os.str();
121 }
122 
123 
130  (const std::string& toolName,
131  const std::string& constName)
132  : std::runtime_error (excBadContextlessRetrieve_format (toolName,
133  constName))
134 {
135 }
136 
137 
138 
144 void throwExcBadContextlessRetrieve (const std::string& toolName,
145  const std::string& constName)
146 {
147  throw ExcBadContextlessRetrieve (toolName, constName);
148 }
149 
150 
151 } // namespace CaloUtils
exceptions.h
Exceptions that can be thrown from CaloUtils.
CaloUtils
Definition: ToolWithConstantsTestTool.h:21
CaloUtils::excConstantReset_format
std::string excConstantReset_format(const std::string &toolName, const std::string &constName)
Helper: Format exception string.
Definition: Calorimeter/CaloUtils/src/exceptions.cxx:86
CaloUtils::ExcBadContextlessRetrieve::ExcBadContextlessRetrieve
ExcBadContextlessRetrieve(const std::string &toolName, const std::string &constName)
Constructor.
Definition: Calorimeter/CaloUtils/src/exceptions.cxx:130
CaloUtils::excConstantNotSet_format
std::string excConstantNotSet_format(const std::string &toolName, const std::string &constName)
Helper: Format exception string.
Definition: Calorimeter/CaloUtils/src/exceptions.cxx:58
CaloUtils::ExcBadContextlessRetrieve
Exception — Bad contextless retrieve.
Definition: Calorimeter/CaloUtils/CaloUtils/exceptions.h:94
CaloUtils::ExcBadToolConstantVersion::ExcBadToolConstantVersion
ExcBadToolConstantVersion(const std::string &toolName, const std::string &constName, unsigned int toolVersion, unsigned int constVersion)
Constructor.
Definition: Calorimeter/CaloUtils/src/exceptions.cxx:42
CaloUtils::ExcConstantReset::ExcConstantReset
ExcConstantReset(const std::string &toolName, const std::string &constName)
Constructor.
Definition: Calorimeter/CaloUtils/src/exceptions.cxx:102
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
CaloUtils::excBadContextlessRetrieve_format
std::string excBadContextlessRetrieve_format(const std::string &toolName, const std::string &constName)
Helper: Format exception string.
Definition: Calorimeter/CaloUtils/src/exceptions.cxx:114
CaloUtils::excBadToolConstantVersion_format
std::string excBadToolConstantVersion_format(const std::string &toolName, const std::string &constName, unsigned int toolVersion, unsigned int constVersion)
Helper: Format exception string.
Definition: Calorimeter/CaloUtils/src/exceptions.cxx:20
CaloUtils::throwExcBadContextlessRetrieve
void throwExcBadContextlessRetrieve(const std::string &toolName, const std::string &constName)
Throw a CaloUtils::ExcBadContextlessRetrieve exception.
Definition: Calorimeter/CaloUtils/src/exceptions.cxx:144
CaloUtils::ExcConstantNotSet::ExcConstantNotSet
ExcConstantNotSet(const std::string &toolName, const std::string &constName)
Constructor.
Definition: Calorimeter/CaloUtils/src/exceptions.cxx:74