From 835a7d00a9da37b07cdf450899ac7fd0125b3320 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Sun, 12 Sep 2021 13:42:23 +0200 Subject: Some error handling improvements in zenhttp Primarily replaces some exception usage with std::error_code --- zenhttp/include/zenhttp/httpserver.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'zenhttp/include') diff --git a/zenhttp/include/zenhttp/httpserver.h b/zenhttp/include/zenhttp/httpserver.h index 4267903ae..b73646dad 100644 --- a/zenhttp/include/zenhttp/httpserver.h +++ b/zenhttp/include/zenhttp/httpserver.h @@ -259,16 +259,15 @@ protected: ExtendableStringBuilder<256> m_QueryStringUtf8; }; -class HttpServerException : public std::exception +class HttpServerException : public std::system_error { public: - HttpServerException(const char* Message, uint32_t Error); + HttpServerException(std::string_view Message, std::error_code Error) : std::system_error(Error), m_What(Message) {} virtual const char* what() const override; -private: - uint32_t m_ErrorCode; - std::string m_Message; +protected: + std::string m_What; }; /** -- cgit v1.2.3