MRPT  2.0.4
test.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 /** \example core_exceptions_example/test.cpp */
11 
12 //! [example-nested-exceptions]
13 
14 #include <mrpt/core/exceptions.h>
15 #include <iostream>
16 
18 {
20  THROW_EXCEPTION("Aw!");
21  MRPT_END
22 }
23 
25 {
28  MRPT_END
29 }
30 
32 {
35  MRPT_END
36 }
37 
38 int main()
39 {
40  try
41  {
43  return 0;
44  }
45  catch (const std::exception& e)
46  {
47  std::cerr << mrpt::exception_to_str(e);
48  return -1;
49  }
50 }
51 //! [example-nested-exceptions]
exceptions.h
test_except_3rd_lvl
void test_except_3rd_lvl()
Definition: exception_unittest.cpp:20
THROW_EXCEPTION
#define THROW_EXCEPTION(msg)
Definition: exceptions.h:67
main
int main()
Definition: vision_stereo_rectify/test.cpp:78
MRPT_START
#define MRPT_START
Definition: exceptions.h:241
MRPT_END
#define MRPT_END
Definition: exceptions.h:245
test_except_2nd_lvl
void test_except_2nd_lvl()
Definition: exception_unittest.cpp:27
mrpt::exception_to_str
std::string exception_to_str(const std::exception &e)
Builds a nice textual representation of a nested exception, which if generated using MRPT macros (THR...
Definition: exceptions.cpp:59
test_except_toplevel
void test_except_toplevel()
Definition: exception_unittest.cpp:34



Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Sun Jul 19 15:15:43 UTC 2020