LCOV - code coverage report
Current view: top level - dbe/src/internal - config_api.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 22 0
Test Date: 2026-10-11 15:05:20 Functions: 0.0 % 5 0

            Line data    Source code
       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/config_api_version.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              : 
      23              : char const* const dbe_lib_config_api_version = dbe_compiled_version;
      24              : 
      25              : //------------------------------------------------------------------------------------------
      26              : //                                      DBE::CONFIG::ERRORS NAMESPACE
      27              : //------------------------------------------------------------------------------------------
      28              : namespace dbe {
      29              : namespace config {
      30              : namespace errors {
      31              : 
      32              : /**
      33              :  * Unwind all causes linked to this exception
      34              :  *
      35              :  * @param ex the exception to process
      36              :  * @return a string
      37              :  */
      38              : std::string const
      39            0 : unwind(ers::Issue const& exception)
      40              : {
      41              : 
      42            0 :   if (ers::Issue const* cause = exception.cause()) {
      43            0 :     std::stringstream s;
      44              : 
      45            0 :     while (cause != nullptr) {
      46            0 :       s << cause->what() << "\n";
      47            0 :       cause = cause->cause();
      48              :     }
      49              : 
      50            0 :     return s.str();
      51            0 :   } else {
      52            0 :     return topcause(exception);
      53              :   }
      54              : }
      55              : 
      56              : /**
      57              :  * Provide a string with the reason given by the exception
      58              :  *
      59              :  * @param ex is the exception to process
      60              :  * @return a string
      61              :  */
      62              : std::string const
      63            0 : reason(ers::Issue const& exception)
      64              : {
      65            0 :   return exception.what();
      66              : }
      67              : 
      68              : /**
      69              :  * Provide a string with the top level cause in this exception
      70              :  *
      71              :  * @param ex is the exception to process
      72              :  * @return a string
      73              :  */
      74              : std::string const
      75            0 : topcause(ers::Issue const& exception)
      76              : {
      77            0 :   if (ers::Issue const* cause = exception.cause()) {
      78            0 :     return cause->what();
      79              :   } else {
      80            0 :     return exception.what();
      81              :   }
      82              : }
      83              : 
      84              : /**
      85              :  * Dump the exception caught at full detail level as specified by the environment
      86              :  * @param ex is the exception to process
      87              :  * @return a string
      88              :  */
      89              : std::string const
      90            0 : dump(ers::Issue const& exception)
      91              : {
      92            0 :   std::stringstream s;
      93            0 :   s << exception;
      94            0 :   return s.str();
      95            0 : }
      96              : 
      97              : std::string const
      98            0 : parse(ers::Issue const& exception)
      99              : {
     100            0 :   return unwind(exception);
     101              : }
     102              : 
     103              : //------------------------------------------------------------------------------------------
     104              : }
     105              : }
     106              : }
     107              : //------------------------------------------------------------------------------------------
        

Generated by: LCOV version 2.0-1