Kurlyk
Toggle main menu visibility
Loading...
Searching...
No Matches
CurlErrorCategory.hpp
Go to the documentation of this file.
1
#pragma once
2
#ifndef _KURLYK_UTILS_CURL_ERROR_CATEGORY_HPP_INCLUDED
3
#define _KURLYK_UTILS_CURL_ERROR_CATEGORY_HPP_INCLUDED
4
7
8
namespace
kurlyk::utils
{
9
12
class
CurlErrorCategory
:
public
std::error_category {
13
public
:
16
const
char
*
name
() const noexcept
override
{
17
return
"curl"
;
18
}
19
23
std::string
message
(
int
ev)
const override
{
24
return
curl_easy_strerror(
static_cast<
CURLcode
>
(ev));
25
}
26
};
27
31
inline
std::error_code
make_error_code
(CURLcode e) {
32
static
CurlErrorCategory
category;
33
return
{
static_cast<
int
>
(e), category};
34
}
35
36
}
// namespace kurlyk::utils
37
38
#endif
// _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:12
kurlyk::utils::CurlErrorCategory::name
const char * name() const noexcept override
Returns the name of the error category.
Definition
CurlErrorCategory.hpp:16
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:23
kurlyk::utils
Definition
Base64Url.hpp:13
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:62
include
kurlyk
utils
CurlErrorCategory.hpp
Generated by
1.17.0