1 |
|
|
/** |
2 |
|
|
* @file exception-tools.cpp |
3 |
|
|
* @author Maximilien Naveau (maximilien.naveau@gmail.com) |
4 |
|
|
* @license License BSD-3-Clause |
5 |
|
|
* @copyright Copyright (c) 2019, New York University and Max Planck Gesellschaft. |
6 |
|
|
* @date 2019-05-22 |
7 |
|
|
*/ |
8 |
|
|
|
9 |
|
|
#include <dynamic_graph_manager/exception/exception-tools.hh> |
10 |
|
|
#include <stdarg.h> |
11 |
|
|
#include <cstdio> |
12 |
|
|
|
13 |
|
|
using namespace dynamic_graph; |
14 |
|
|
|
15 |
|
|
/* --------------------------------------------------------------------- */ |
16 |
|
|
/* --- CLASS ----------------------------------------------------------- */ |
17 |
|
|
/* --------------------------------------------------------------------- */ |
18 |
|
|
|
19 |
✓✗ |
4 |
const std::string ExceptionTools::EXCEPTION_NAME = "Tools"; |
20 |
|
|
|
21 |
|
4 |
ExceptionTools:: |
22 |
|
|
ExceptionTools ( const ExceptionTools::ErrorCodeEnum& errcode, |
23 |
|
|
const std::string & msg ) |
24 |
✓✗ |
4 |
:ExceptionAbstract(errcode,msg) |
25 |
|
|
{ |
26 |
|
4 |
} |
27 |
|
|
|
28 |
|
|
ExceptionTools:: |
29 |
|
|
ExceptionTools ( const ExceptionTools::ErrorCodeEnum& errcode, |
30 |
|
|
const std::string & msg,const char* format, ... ) |
31 |
|
|
:ExceptionAbstract(errcode,msg) |
32 |
|
|
{ |
33 |
|
|
va_list args; |
34 |
|
|
va_start(args,format); |
35 |
|
|
|
36 |
|
|
const unsigned int SIZE = 256; |
37 |
|
|
char buffer[SIZE]; |
38 |
|
|
vsnprintf(buffer,SIZE,format,args); |
39 |
|
|
|
40 |
|
|
message += buffer; |
41 |
|
|
|
42 |
|
|
va_end(args); |
43 |
✓✗✓✗
|
12 |
} |
44 |
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
/* |
48 |
|
|
* Local variables: |
49 |
|
|
* c-basic-offset: 2 |
50 |
|
|
* End: |
51 |
|
|
*/ |