4#include "Stroika/Frameworks/StroikaPreComp.h"
8#include "Stroika/Foundation/IO/Network/HTTP/Exception.h"
11#include "DefaultFaultInterceptor.h"
16using namespace Stroika::Foundation::Memory;
18using namespace Stroika::Frameworks;
30 Response& response = m.rwResponse ();
33 rethrow_exception (e);
36 if (response.responseStatusSent) {
37 DbgTrace (
"response failed after sending the status: {}"_f, current_exception ());
41 response.statusAndOverrideReason = make_tuple (ee.GetStatus (), ee.GetReason ());
42 response.contentType = DataExchange::InternetMediaTypes::kText_PLAIN;
47 if (response.responseStatusSent) {
48 DbgTrace (
"response failed after sending the status: {}"_f, current_exception ());
52 response.status = IO::Network::HTTP::StatusCodes::kInternalError;
53 response.contentType = DataExchange::InternetMediaTypes::kText_PLAIN;
59 DbgTrace (L
"Oops! - not good, but nothing todo but burry it: {}"_f, current_exception ());
68 return "DefaultFaultInterceptor"sv;
73 function<void (
Message&,
const exception_ptr&)> fHandleFault_;
74 Rep_Explicit_ (
const function<
void (
Message&,
const exception_ptr&)>& handleFault)
75 : fHandleFault_{handleFault}
87 return "DefaultFaultInterceptor(user-provided)"sv;
96DefaultFaultInterceptor::DefaultFaultInterceptor ()
100DefaultFaultInterceptor::DefaultFaultInterceptor (
const function<
void (
Message&,
const exception_ptr&)>& handleFault)
104DefaultFaultInterceptor::DefaultFaultInterceptor (
const function<
void (
Message*,
const exception_ptr&)>& handleFault)
105 : DefaultFaultInterceptor{[=] (
Message& m, const exception_ptr& e) { handleFault (&m, e); }}
auto MakeSharedPtr(ARGS_TYPE &&... args) -> shared_ptr< T >
same as make_shared, but if type T has block allocation, then use block allocation for the 'shared pa...
String is like std::u32string, except it is much easier to use, often much more space efficient,...
virtual void HandleMessage(Message &m) const =0
virtual Characters::String ToString() const
virtual void HandleFault(Message &m, const exception_ptr &e) const noexcept
String ToString(T &&t, ARGS... args)
Return a debug-friendly, display version of the argument: not guaranteed parsable or usable except fo...