MRPT
2.0.3
core_exceptions_example/test.cpp
/* +------------------------------------------------------------------------+
| Mobile Robot Programming Toolkit (MRPT) |
| https://www.mrpt.org/ |
| |
| Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
| See: https://www.mrpt.org/Authors - All rights reserved. |
| Released under BSD License. See: https://www.mrpt.org/License |
+------------------------------------------------------------------------+ */
/** \example core_exceptions_example/test.cpp */
//! [example-nested-exceptions]
#include <
mrpt/core/exceptions.h
>
#include <iostream>
void
test_except_3rd_lvl
()
{
MRPT_START
THROW_EXCEPTION
(
"Aw!"
);
MRPT_END
}
void
test_except_2nd_lvl
()
{
MRPT_START
test_except_3rd_lvl
();
MRPT_END
}
void
test_except_toplevel
()
{
MRPT_START
test_except_2nd_lvl
();
MRPT_END
}
int
main
()
{
try
{
test_except_toplevel
();
return
0;
}
catch
(
const
std::exception& e)
{
std::cerr <<
mrpt::exception_to_str
(e);
return
-1;
}
}
//! [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.3 at Thu May 21 21:53:32 UTC 2020