DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
config_api.cpp
Go to the documentation of this file.
1/*
2 * config_api.cpp
3 *
4 * Created on: Nov 2, 2015
5 * Author: Leonidas Georgopoulos
6 */
7
8#include "dbe/Exceptions.hpp"
9#include "dbe/version.hpp"
11
12#include "conffwk/Errors.hpp"
13#include "ers/Issue.hpp"
14#include <algorithm>
15#include <sstream>
16#include <string>
17
19
20//------------------------------------------------------------------------------------------
21// DBE::CONFIG::ERRORS NAMESPACE
22//------------------------------------------------------------------------------------------
23namespace dbe
24{
25namespace config
26{
27namespace errors
28{
29
30namespace
31{
32inline std::string const trendl ( std::string s )
33{
34 s.erase ( std::remove ( s.begin(), s.end(), '\n' ), s.end() );
35 return s;
36}
37}
38
45std::string const unwind ( ers::Issue const & exception )
46{
47
48 if ( ers::Issue const * cause = exception.cause() )
49 {
50 std::stringstream s;
51
52 while ( cause != nullptr )
53 {
54 s << trendl ( cause->what() ) << "\n";
55 cause = cause->cause();
56 }
57
58 return s.str();
59 }
60 else
61 {
62 return topcause ( exception );
63 }
64
65}
66
73std::string const reason ( ers::Issue const & exception )
74{
75 return exception.what();
76}
77
84std::string const topcause ( ers::Issue const & exception )
85{
86 if ( ers::Issue const * cause = exception.cause() )
87 {
88 return cause->what();
89 }
90 else
91 {
92 return exception.what();
93 }
94}
95
101std::string const dump ( ers::Issue const & exception )
102{
103 std::stringstream s;
104 s << exception;
105 return s.str();
106}
107
108std::string const parse ( ers::Issue const & exception )
109{
110 return unwind ( exception );
111}
112
113//------------------------------------------------------------------------------------------
114}
115}
116}
117//------------------------------------------------------------------------------------------
118
Base class for any user define issue.
Definition Issue.hpp:69
const Issue * cause() const
return the cause Issue of this Issue
Definition Issue.hpp:97
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:17