Functions
test_exceptions.cxx File Reference
#include "WireCellUtil/Exceptions.h"
#include "WireCellUtil/String.h"
#include <iostream>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 12 of file test_exceptions.cxx.

13 {
14  int value = 42;
15  std::string omg = "omg";
16  const double number = 6.9;
17 
18  cerr << format("something") << endl;
19  cerr << format("value=%d", value) << endl;
20  cerr << format("value=%d, omg=\"%s\", number=%f", value, omg, number) << endl;
21 
22 
23  try {
24  THROW(ValueError() << errmsg{format("some error with value=%d msg=\"%s\"", value, omg)});
25  }
26  catch (ValueError& e) {
27  cerr << "caught ValueError: " << errstr(e) << endl;
28  }
29 
30 
31 }
std::string string
Definition: nybbler.cc:12
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
#define errstr(e)
Definition: Exceptions.h:26
const double e
#define THROW(e)
Definition: Exceptions.h:25
Thrown when a wrong value has been encountered.
Definition: Exceptions.h:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
QTextStream & endl(QTextStream &s)