Specs
Beautiful C++ Test Framework
Loading...
Searching...
No Matches
SpecsCpp::ExceptionHandlers::SnowhouseExceptionHandler Class Reference

#include <SnowhouseExceptionHandler.h>

Inheritance diagram for SpecsCpp::ExceptionHandlers::SnowhouseExceptionHandler:
SpecsCpp::ILocalSpecExceptionHandler

Public Member Functions

bool handle_exception (std::exception_ptr *exception, IExceptionMessageCallbackFn *failureMessageCallback) override
 
- Public Member Functions inherited from SpecsCpp::ILocalSpecExceptionHandler
virtual ~ILocalSpecExceptionHandler ()=default
 
virtual bool handle_exception (std::exception_ptr *exception, LocalSpecExceptionFailureMessageCallbackFn *failureMessageCallback)=0
 

Additional Inherited Members

- Public Types inherited from SpecsCpp::ILocalSpecExceptionHandler
using LocalSpecExceptionFailureMessageCallbackFn = IFunctionPointer< void(IExceptionMessage *)>
 

Detailed Description

Definition at line 15 of file SnowhouseExceptionHandler.h.

Member Function Documentation

◆ handle_exception()

bool SpecsCpp::ExceptionHandlers::SnowhouseExceptionHandler::handle_exception ( std::exception_ptr *  exception,
IExceptionMessageCallbackFn failureMessageCallback 
)
inlineoverridevirtual

Implements SpecsCpp::ILocalSpecExceptionHandler.

Definition at line 58 of file SnowhouseExceptionHandler.h.

60 {
61 try {
62 std::rethrow_exception(*exception);
63 } catch (const snowhouse::AssertionException& e) {
64 if (failureMessageCallback) {
65 SpecExceptionMessage failureMessage{string_format(
66 "{}\n[{}:{}] {}", e.what(), e.file(), e.line(),
67 ReadLineFromFile(e.file(), e.line())
68 )};
69 failureMessageCallback->invoke(&failureMessage);
70 }
71 return true;
72 } catch (...) {
73 return false;
74 }
75 }

The documentation for this class was generated from the following file: