MRPT
1.9.9
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]
Page generated by
Doxygen 1.8.14
for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020