Public Member Functions | Private Member Functions | Private Attributes | List of all members
daqdataformats::DataFormatException Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-25/DAQDataFormats/cxx/include/DataFormatException.h"

Inheritance diagram for daqdataformats::DataFormatException:

Public Member Functions

 DataFormatException (const std::string &pretty_function, const std::string &file_name, int line, const std::string &message, const std::string dataformat_class_name="", const std::string dataformat_constructor="")
 
 DataFormatException (const std::string &message)
 
const char * what () const noexcept override
 

Private Member Functions

std::string constructMessage (std::string const *const pretty_function, std::string const *const file_name, int line, std::string const *const message, std::string const *const dataformat_class_name, std::string const *const dataformat_constructor)
 Construct exception message. More...
 

Private Attributes

std::string _fullText
 

Detailed Description

Class to report exceptions in the DAQDataFormats package.

Author
Kurt Biery
Version
Revision
1.7.12.1
Date
2019/09/27 00:06:51

Definition at line 29 of file DataFormatException.h.

Constructor & Destructor Documentation

daqdataformats::DataFormatException::DataFormatException ( const std::string pretty_function,
const std::string file_name,
int  line,
const std::string message,
const std::string  dataformat_class_name = "",
const std::string  dataformat_constructor = "" 
)
inline

Constructs a data format exception instance from the specified file, line number, and message.

Definition at line 37 of file DataFormatException.h.

44  : _fullText(constructMessage(&pretty_function,
45  &file_name,
46  line,
47  &message,
48  &dataformat_class_name,
49  &dataformat_constructor))
50  {
51  }
std::string constructMessage(std::string const *const pretty_function, std::string const *const file_name, int line, std::string const *const message, std::string const *const dataformat_class_name, std::string const *const dataformat_constructor)
Construct exception message.
daqdataformats::DataFormatException::DataFormatException ( const std::string message)
inline

Definition at line 53 of file DataFormatException.h.

54  : _fullText(constructMessage(nullptr,
55  nullptr,
56  0,
57  &message,
58  nullptr,
59  nullptr))
60  {
61  }
std::string constructMessage(std::string const *const pretty_function, std::string const *const file_name, int line, std::string const *const message, std::string const *const dataformat_class_name, std::string const *const dataformat_constructor)
Construct exception message.

Member Function Documentation

std::string daqdataformats::DataFormatException::constructMessage ( std::string const *const  pretty_function,
std::string const *const  file_name,
int  line,
std::string const *const  message,
std::string const *const  dataformat_class_name,
std::string const *const  dataformat_constructor 
)
inlineprivate

Construct exception message.

build up the exception text

Add function name

Add File name

Add Line number

if dataformat class name is given, print it

if dataformat constructor name is given, print it

add some limited stack trace information

Definition at line 71 of file DataFormatException.h.

References allTimeWatchdog::endl, ConvertToSnowGlobesInput::file_name, compare_h5_caf::idx, fillBadChanDBTables::result, gen_flatrecord::size, string, and art::to_string().

77  {
79  /// build up the exception text
80  result = *message + "\n" + " DataFormatException generated";
81 
82  /// Add function name
83  if(pretty_function && pretty_function->size() > 0){
84  result.append(" in function" + *pretty_function);
85  }
86 
87  /// Add File name
88  if(file_name && file_name->size() > 0){
89  result += " in File " + *file_name;
90  }
91 
92  /// Add Line number
93  if(line > 0){
94  result += " Line:" + std::to_string(line) + '.';
95  }
96 
97  /// if dataformat class name is given, print it
98  if(dataformat_class_name && dataformat_class_name->size() > 0){
99  result += "\nDataFormat Class: " + *dataformat_class_name + ".";
100  }
101 
102  /// if dataformat constructor name is given, print it
103  if(dataformat_constructor && dataformat_constructor->size() > 0){
104  result += " DataFormat Constructor: " + *dataformat_constructor + ".";
105  }// end if dataformat class name is given
106 
107  result.append(".");
108 
109  /// add some limited stack trace information
110  void *array[10];
111  const size_t size = backtrace (array, 10);
112 
113  char** strings = backtrace_symbols (array, size);
114 
115  std::stringstream tmpStream;
116  for (size_t idx = 0; idx < size; idx++) {
117  tmpStream << " " << strings[idx] << std::endl;
118  }
119  free (strings);
120 
121  result += "\n Stack trace:\n" + tmpStream.str();
122 
123  //std::cout<<_fullText<<"\n";
124 
125  return result;
126  }
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
enum BeamMode string
const char* daqdataformats::DataFormatException::what ( ) const
inlineoverridenoexcept

Definition at line 63 of file DataFormatException.h.

References _fullText.

64  {
65  return _fullText.c_str();
66  }

Member Data Documentation

std::string daqdataformats::DataFormatException::_fullText
private

Definition at line 129 of file DataFormatException.h.

Referenced by what().


The documentation for this class was generated from the following file: