Kurlyk
Toggle main menu visibility
Loading...
Searching...
No Matches
CurlErrorCategory.hpp
Go to the documentation of this file.
1
#pragma once
2
#ifndef KURLYK_HEADER_KURLYK_UTILS_CURL_ERROR_CATEGORY_HPP_INCLUDED
3
#define KURLYK_HEADER_KURLYK_UTILS_CURL_ERROR_CATEGORY_HPP_INCLUDED
4
7
8
namespace
kurlyk
{
9
namespace
utils {
10
13
class
CurlErrorCategory
:
public
std::error_category {
14
public
:
17
const
char
*
name
() const noexcept
override
{
18
return
"curl"
;
19
}
20
24
std::string
message
(
int
ev)
const override
{
25
return
curl_easy_strerror(
static_cast<
CURLcode
>
(ev));
26
}
27
};
28
32
inline
std::error_code
make_error_code
(CURLcode e) {
33
static
CurlErrorCategory
category;
34
return
{
static_cast<
int
>
(e), category};
35
}
36
37
}
// namespace utils
38
}
// namespace kurlyk
39
40
#endif
// KURLYK_HEADER_KURLYK_UTILS_CURL_ERROR_CATEGORY_HPP_INCLUDED
kurlyk::utils::CurlErrorCategory
Represents a custom error category for CURL errors, enabling integration with std::error_code.
Definition
CurlErrorCategory.hpp:13
kurlyk::utils::CurlErrorCategory::name
const char * name() const noexcept override
Returns the name of the error category.
Definition
CurlErrorCategory.hpp:17
kurlyk::utils::CurlErrorCategory::message
std::string message(int ev) const override
Returns a descriptive error message for a given CURL error code.
Definition
CurlErrorCategory.hpp:24
kurlyk::utils::make_error_code
std::error_code make_error_code(ClientError e)
Creates a std::error_code from a ClientError value.
Definition
ClientErrorCategory.hpp:63
kurlyk
Primary namespace for the Kurlyk library, encompassing initialization, request management,...
include
kurlyk
utils
CurlErrorCategory.hpp
Generated by
1.17.0