Hydra 0.0.1
A convenience networking library for modern C++
 
Loading...
Searching...
No Matches
http_error.h
1#ifndef SOURCEMETA_HYDRA_HTTP_ERROR_H
2#define SOURCEMETA_HYDRA_HTTP_ERROR_H
3
4#ifndef SOURCEMETA_HYDRA_HTTP_EXPORT
5#include <sourcemeta/hydra/http_export.h>
6#endif
7
8#include <exception> // std::exception
9#include <string> // std::string
10
11namespace sourcemeta::hydra::http {
12
13// Exporting symbols that depends on the standard C++ library is considered
14// safe.
15// https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4275?view=msvc-170&redirectedfrom=MSDN
16#if defined(_MSC_VER)
17#pragma warning(disable : 4251 4275)
18#endif
19
22class SOURCEMETA_HYDRA_HTTP_EXPORT Error : public std::exception {
23public:
24 // We don't want to document this internal constructor
25#if !defined(DOXYGEN)
26 Error(std::string message);
27#endif
28
30 [[nodiscard]] auto what() const noexcept -> const char * override;
31
32private:
33 std::string message_;
34};
35
36#if defined(_MSC_VER)
37#pragma warning(default : 4251 4275)
38#endif
39
40} // namespace sourcemeta::hydra::http
41
42#endif
Definition http_error.h:22
auto what() const noexcept -> const char *override
Get the error message.