ADTF
ucom3/include/adtfucom3/exception_handling.h File Reference

Copyright © Audi Electronics Venture GmbH. More...

Go to the source code of this file.

Namespaces

 adtf
 Namespace for entire ADTF SDK.
 
 adtf::ucom
 Namespace for the ADTF uCOM3 SDK.
 
 adtf::ucom::kiwi
 Namespace for all functionality provided since v3.10.
 

Macros

#define ADTF_UCOM_ANNOTATE_RESULT(_result)   adtf::ucom::kiwi::detail::annotate_result(_result, __FILE__, __LINE__, __FUNC__)
 for internal use
 
#define ADTF_UCOM_COMPOSED_RESULT(_result, ...)   adtf::ucom::kiwi::detail::annotate_result(_result, __FILE__, __LINE__, __FUNC__, adtf::util::cString::Format(__VA_ARGS__).GetPtr())
 for internal use
 
#define THROW_ERROR_DESC(_code, ...)   throw DETAILED_RESULT(_code, __VA_ARGS__)
 throws a tResult exception
 
#define THROW_IF_FAILED(s)   { tResult _errcode(s); if ( _errcode.IsFailed() ) { throw ADTF_UCOM_ANNOTATE_RESULT(_errcode); } }
 throws if the expression returns a failed tResult
 
#define THROW_IF_FAILED_DESC(s, ...)   { tResult _errcode(s); if ( _errcode.IsFailed() ) { throw ADTF_UCOM_COMPOSED_RESULT(_errcode, __VA_ARGS__); } }
 throws if the expression returns a failed tResult and ammends the error message.
 
#define RETURN_CURRENT_EXCEPTION()   return adtf::ucom::kiwi::detail::current_exception_to_result(__FILE__, __LINE__, __FUNC__)
 returns the current exception as a tResult, use it in a catch block.
 
#define RETURN_CURRENT_EXCEPTION_DESC(...)   return ADTF_UCOM_COMPOSED_RESULT(adtf::ucom::kiwi::detail::current_exception_to_result(__FILE__, __LINE__, __FUNC__), __VA_ARGS__)
 returns the current exception as a tResult and ammends the error message.
 
#define RETURN_IF_THROWS(s)   { try { (s); } catch(...) { RETURN_CURRENT_EXCEPTION(); } }
 if the expression throws an exception, returns a tResult containing the exception information.
 
#define RETURN_IF_THROWS_DESC(s, ...)   { try { (s); } catch(...) { RETURN_CURRENT_EXCEPTION_DESC(__VA_ARGS__); } }
 if the expression throws an exception, returns a tResult containing the exception information and ammends the error message.
 
#define RETURN_IF_FAILED(s)   { try { tResult _errcode(s); if ( _errcode.IsFailed() ) { return ADTF_UCOM_ANNOTATE_RESULT(_errcode); } } catch (...) { RETURN_CURRENT_EXCEPTION(); } }
 returns if the expression returns a failed tResult or throws an exception.
 
#define RETURN_IF_FAILED_DESC(s, ...)   { try { tResult _errcode(s); if ( _errcode.IsFailed() ) { return ADTF_UCOM_COMPOSED_RESULT(_errcode, __VA_ARGS__); } } catch (...) { RETURN_CURRENT_EXCEPTION_DESC(__VA_ARGS__); } }
 returns if the expression returns a failed tResult and ammends the error message.
 

Functions

std::string nested_exceptions_to_string (const std::exception &error)
 Formats nested std::exceptions into a string, line by line. More...
 
void format_nested_exception (const std::exception &error, std::ostream &stream, bool add_line_break=false)
 
tResult annotate_result (const tResult &oOriginal, const char *strFile, int nLine, const char *strFunction, const tChar *strDescription="")
 
tResult current_exception_to_result (const char *file, size_t line, const char *function)
 
std::string current_exception_to_string ()
 Trys to format the current exception into a string. More...
 
tResult current_exception_to_result ()
 Converts the current exception object into a tResult. More...
 

Detailed Description

Copyright © Audi Electronics Venture GmbH.

All rights reserved

Definition in file ucom3/include/adtfucom3/exception_handling.h.