4#include "Stroika/Frameworks/StroikaPreComp.h"
8#include "Stroika/Foundation/IO/Network/HTTP/Exception.h"
10#include "DefaultFaultInterceptor.h"
15using namespace Stroika::Foundation::Memory;
17using namespace Stroika::Frameworks;
29 Response& response = m.rwResponse ();
32 rethrow_exception (e);
35 if (response.responseStatusSent) {
36 DbgTrace (
"response failed after sending the status: {}"_f, current_exception ());
40 response.statusAndOverrideReason = make_tuple (ee.GetStatus (), ee.GetReason ());
41 response.contentType = DataExchange::InternetMediaTypes::kText_PLAIN;
46 if (response.responseStatusSent) {
47 DbgTrace (
"response failed after sending the status: {}"_f, current_exception ());
51 response.status = IO::Network::HTTP::StatusCodes::kInternalError;
52 response.contentType = DataExchange::InternetMediaTypes::kText_PLAIN;
58 DbgTrace (L
"Oops! - not good, but nothing todo but burry it: {}"_f, current_exception ());
67 return "DefaultFaultInterceptor"sv;
72 function<void (
Message&,
const exception_ptr&)> fHandleFault_;
73 Rep_Explicit_ (
const function<
void (
Message&,
const exception_ptr&)>& handleFault)
74 : fHandleFault_{handleFault}
86 return "DefaultFaultInterceptor(user-provided)"sv;
95DefaultFaultInterceptor::DefaultFaultInterceptor ()
96 : inherited{make_shared<Rep_> ()}
99DefaultFaultInterceptor::DefaultFaultInterceptor (
const function<
void (
Message&,
const exception_ptr&)>& handleFault)
100 : inherited{make_shared<Rep_Explicit_> (handleFault)}
103DefaultFaultInterceptor::DefaultFaultInterceptor (
const function<
void (
Message*,
const exception_ptr&)>& handleFault)
104 : DefaultFaultInterceptor{[=] (
Message& m, const exception_ptr& e) { handleFault (&m, e); }}
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...