Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
util
test
test_exceptions.cxx
Go to the documentation of this file.
1
#include "
WireCellUtil/Exceptions.h
"
2
#include "
WireCellUtil/String.h
"
3
4
#include <iostream>
5
6
using namespace
WireCell
;
7
using namespace
std
;
8
9
using
WireCell::String::format
;
10
11
12
int
main
()
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
}
Exceptions.h
string
std::string string
Definition:
nybbler.cc:12
WireCell::errmsg
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition:
Exceptions.h:54
std
STL namespace.
errstr
#define errstr(e)
Definition:
Exceptions.h:26
e
const double e
Definition:
gUpMuFluxGen.cxx:165
submit_mcc.format
format
Definition:
submit_mcc.py:24
THROW
#define THROW(e)
Definition:
Exceptions.h:25
WireCell::ValueError
Thrown when a wrong value has been encountered.
Definition:
Exceptions.h:37
WireCell::String::format
std::string format(const std::string &form, TYPES...objs)
Definition:
String.h:45
WireCell
Definition:
Main.h:22
value
const GenericPointer< typename T::ValueType > T2 value
Definition:
pointer.h:1225
main
int main()
Definition:
test_exceptions.cxx:12
String.h
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11