Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
opt
cpr
include
cpr
error.h
Go to the documentation of this file.
1
#ifndef CPR_ERROR_H
2
#define CPR_ERROR_H
3
4
#include <cstdint>
5
#include <string>
6
7
#include "
cpr/cprtypes.h
"
8
#include "
cpr/defines.h
"
9
10
namespace
cpr
{
11
12
enum class
ErrorCode
{
13
OK
= 0,
14
CONNECTION_FAILURE
,
15
EMPTY_RESPONSE
,
16
HOST_RESOLUTION_FAILURE
,
17
INTERNAL_ERROR
,
18
INVALID_URL_FORMAT
,
19
NETWORK_RECEIVE_ERROR
,
20
NETWORK_SEND_FAILURE
,
21
OPERATION_TIMEDOUT
,
22
PROXY_RESOLUTION_FAILURE
,
23
SSL_CONNECT_ERROR
,
24
SSL_LOCAL_CERTIFICATE_ERROR
,
25
SSL_REMOTE_CERTIFICATE_ERROR
,
26
SSL_CACERT_ERROR
,
27
GENERIC_SSL_ERROR
,
28
UNSUPPORTED_PROTOCOL
,
29
UNKNOWN_ERROR
= 1000,
30
};
31
32
class
Error
{
33
public
:
34
Error
() : code{
ErrorCode::OK
} {}
35
36
template
<
typename
TextType>
37
Error
(
const
std::int32_t& curl_code, TextType&& p_error_message)
38
: code{getErrorCodeForCurlError(curl_code)}, message{
CPR_FWD
(p_error_message)} {}
39
40
explicit
operator
bool
()
const
{
41
return
code !=
ErrorCode::OK
;
42
}
43
44
ErrorCode
code
;
45
std::string
message
;
46
47
private
:
48
static
ErrorCode
getErrorCodeForCurlError(std::int32_t curl_code);
49
};
50
51
}
// namespace cpr
52
53
#endif
cpr::ErrorCode::NETWORK_SEND_FAILURE
cpr::ErrorCode::UNSUPPORTED_PROTOCOL
cpr::Error::code
ErrorCode code
Definition:
error.h:44
cpr::ErrorCode::OPERATION_TIMEDOUT
testing::internal::string
::std::string string
Definition:
gtest-port.h:1129
cpr::ErrorCode::PROXY_RESOLUTION_FAILURE
cpr::ErrorCode::INVALID_URL_FORMAT
cpr::ErrorCode::INTERNAL_ERROR
cpr::ErrorCode::SSL_CONNECT_ERROR
cprtypes.h
cpr::Error::Error
Error(const std::int32_t &curl_code, TextType &&p_error_message)
Definition:
error.h:37
CPR_FWD
#define CPR_FWD(...)
Definition:
defines.h:6
cpr::ErrorCode::UNKNOWN_ERROR
defines.h
cpr::ErrorCode
ErrorCode
Definition:
error.h:12
cpr::ErrorCode::EMPTY_RESPONSE
cpr::Error::Error
Error()
Definition:
error.h:34
bool
bool
Definition:
curl_setup_once.h:319
cpr::Error::message
std::string message
Definition:
error.h:45
cpr::Error
Definition:
error.h:32
cpr::ErrorCode::SSL_LOCAL_CERTIFICATE_ERROR
cpr::ErrorCode::SSL_CACERT_ERROR
cpr::ErrorCode::OK
cpr
Definition:
auth.cpp:3
cpr::ErrorCode::SSL_REMOTE_CERTIFICATE_ERROR
cpr::ErrorCode::HOST_RESOLUTION_FAILURE
cpr::ErrorCode::CONNECTION_FAILURE
cpr::ErrorCode::GENERIC_SSL_ERROR
cpr::ErrorCode::NETWORK_RECEIVE_ERROR
rc_tagdetect_client
Author(s): Monika Florek-Jasinska
, Raphael Schaller
autogenerated on Sat Feb 13 2021 03:42:09