DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
config_api.cpp
Go to the documentation of this file.
1// DUNE DAQ modification notice:
2// This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
3// Fork baseline commit: dbe-02-12-17 (2022-05-12).
4// Renamed since fork: no.
5
6/*
7 * config_api.cpp
8 *
9 * Created on: Nov 2, 2015
10 * Author: Leonidas Georgopoulos
11 */
12
13#include "dbe/Exceptions.hpp"
15#include "dbe/version.hpp"
16
17#include "conffwk/Errors.hpp"
18#include "ers/Issue.hpp"
19#include <algorithm>
20#include <sstream>
21#include <string>
22
24
25//------------------------------------------------------------------------------------------
26// DBE::CONFIG::ERRORS NAMESPACE
27//------------------------------------------------------------------------------------------
28namespace dbe {
29namespace config {
30namespace errors {
31
38std::string const
39unwind(ers::Issue const& exception)
40{
41
42 if (ers::Issue const* cause = exception.cause()) {
43 std::stringstream s;
44
45 while (cause != nullptr) {
46 s << cause->what() << "\n";
47 cause = cause->cause();
48 }
49
50 return s.str();
51 } else {
52 return topcause(exception);
53 }
54}
55
62std::string const
63reason(ers::Issue const& exception)
64{
65 return exception.what();
66}
67
74std::string const
75topcause(ers::Issue const& exception)
76{
77 if (ers::Issue const* cause = exception.cause()) {
78 return cause->what();
79 } else {
80 return exception.what();
81 }
82}
83
89std::string const
90dump(ers::Issue const& exception)
91{
92 std::stringstream s;
93 s << exception;
94 return s.str();
95}
96
97std::string const
98parse(ers::Issue const& exception)
99{
100 return unwind(exception);
101}
102
103//------------------------------------------------------------------------------------------
104}
105}
106}
107//------------------------------------------------------------------------------------------
Base class for any user define issue.
Definition Issue.hpp:76
const char * what() const noexcept
General cause of the issue.
Definition Issue.hpp:133
const Issue * cause() const
return the cause Issue of this Issue
Definition Issue.hpp:100
char const *const dbe_lib_config_api_version
std::string const parse(ers::Issue const &)
std::string const topcause(ers::Issue const &)
std::string const dump(ers::Issue const &)
std::string const unwind(ers::Issue const &)
std::string const reason(ers::Issue const &)
Include QT Headers.
#define dbe_compiled_version
Definition version.hpp:22