mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-15 14:47:13 +02:00
Major plugin refactor and cleanup.
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
This commit is contained in:
54
vendor/CPR/include/cpr/error.h
vendored
Normal file
54
vendor/CPR/include/cpr/error.h
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
#ifndef CPR_ERROR_H
|
||||
#define CPR_ERROR_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include "cpr/cprtypes.h"
|
||||
#include <utility>
|
||||
|
||||
namespace cpr {
|
||||
|
||||
enum class ErrorCode {
|
||||
OK = 0,
|
||||
CONNECTION_FAILURE,
|
||||
EMPTY_RESPONSE,
|
||||
HOST_RESOLUTION_FAILURE,
|
||||
INTERNAL_ERROR,
|
||||
INVALID_URL_FORMAT,
|
||||
NETWORK_RECEIVE_ERROR,
|
||||
NETWORK_SEND_FAILURE,
|
||||
OPERATION_TIMEDOUT,
|
||||
PROXY_RESOLUTION_FAILURE,
|
||||
SSL_CONNECT_ERROR,
|
||||
SSL_LOCAL_CERTIFICATE_ERROR,
|
||||
SSL_REMOTE_CERTIFICATE_ERROR,
|
||||
SSL_CACERT_ERROR,
|
||||
GENERIC_SSL_ERROR,
|
||||
UNSUPPORTED_PROTOCOL,
|
||||
REQUEST_CANCELLED,
|
||||
UNKNOWN_ERROR = 1000,
|
||||
};
|
||||
|
||||
class Error {
|
||||
public:
|
||||
ErrorCode code = ErrorCode::OK;
|
||||
std::string message{};
|
||||
|
||||
Error() = default;
|
||||
|
||||
Error(const std::int32_t& curl_code, std::string&& p_error_message)
|
||||
: code{getErrorCodeForCurlError(curl_code)},
|
||||
message(std::move(p_error_message)) {}
|
||||
|
||||
explicit operator bool() const {
|
||||
return code != ErrorCode::OK;
|
||||
}
|
||||
|
||||
private:
|
||||
static ErrorCode getErrorCodeForCurlError(std::int32_t curl_code);
|
||||
};
|
||||
|
||||
} // namespace cpr
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user