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"
14#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
29{
30namespace config
31{
32namespace errors
33{
34
35namespace
36{
37inline std::string const trendl ( std::string s )
38{
39 s.erase ( std::remove ( s.begin(), s.end(), '\n' ), s.end() );
40 return s;
41}
42}
43
50std::string const unwind ( ers::Issue const & exception )
51{
52
53 if ( ers::Issue const * cause = exception.cause() )
54 {
55 std::stringstream s;
56
57 while ( cause != nullptr )
58 {
59 s << trendl ( cause->what() ) << "\n";
60 cause = cause->cause();
61 }
62
63 return s.str();
64 }
65 else
66 {
67 return topcause ( exception );
68 }
69
70}
71
78std::string const reason ( ers::Issue const & exception )
79{
80 return exception.what();
81}
82
89std::string const topcause ( ers::Issue const & exception )
90{
91 if ( ers::Issue const * cause = exception.cause() )
92 {
93 return cause->what();
94 }
95 else
96 {
97 return exception.what();
98 }
99}
100
106std::string const dump ( ers::Issue const & exception )
107{
108 std::stringstream s;
109 s << exception;
110 return s.str();
111}
112
113std::string const parse ( ers::Issue const & exception )
114{
115 return unwind ( exception );
116}
117
118//------------------------------------------------------------------------------------------
119}
120}
121}
122//------------------------------------------------------------------------------------------
123
Base class for any user define issue.
Definition Issue.hpp:80
char const *const dbe_lib_config_api_version
caught dunedaq::conffwk::Exception exception
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