The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
StatusCode.cpp
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#define GAUDIKERNEL_STATUSCODE_CPP 1
12
19#include <GaudiKernel/System.h>
20#include <exception>
21
25
26namespace {
28 struct DefaultCategory : public StatusCode::Category {
29
30 const char* name() const override { return "Gaudi"; }
31
32 std::string message( StatusCode::code_t code ) const override {
33 switch ( static_cast<StatusCode::ErrorCode>( code ) ) {
35 return "SUCCESS";
37 return "FAILURE";
39 return "RECOVERABLE";
40 default:
41 return "UNKNOWN(" + std::to_string( code ) + ")";
42 }
43 }
44 };
45} // namespace
46
48
49void StatusCode::i_doThrow( std::string_view message, std::string_view tag ) const {
50 throw GaudiException{ std::string{ message }, std::string{ tag }, *this };
51}
#define STATUSCODE_ENUM_IMPL(...)
Assign a category to the StatusCode enum declared with STATUSCODE_ENUM_DECL( ENUM )
Definition StatusCode.h:295
Define general base for Gaudi exception.
StatusCode()=default
Default constructor.
unsigned long code_t
type of StatusCode value
Definition StatusCode.h:66
std::string message() const
Description (or name) of StatusCode value.
Definition StatusCode.h:224
constexpr static const auto RECOVERABLE
Definition StatusCode.h:101
void i_doThrow(std::string_view message, std::string_view tag) const
Helper function to avoid circular dependency between GaudiException.h and StatusCode....
constexpr static const auto SUCCESS
Definition StatusCode.h:99
constexpr static const auto FAILURE
Definition StatusCode.h:100
STL namespace.
The category assigned to a StatusCode.