error.h
Go to the documentation of this file.
00001 #ifndef CPR_ERROR_H
00002 #define CPR_ERROR_H
00003 
00004 #include <cstdint>
00005 #include <string>
00006 
00007 #include "cprtypes.h"
00008 #include "defines.h"
00009 
00010 namespace cpr {
00011 
00012 enum class ErrorCode {
00013     OK = 0,
00014     CONNECTION_FAILURE,
00015     EMPTY_RESPONSE,
00016     HOST_RESOLUTION_FAILURE,
00017     INTERNAL_ERROR,
00018     INVALID_URL_FORMAT,
00019     NETWORK_RECEIVE_ERROR,
00020     NETWORK_SEND_FAILURE,
00021     OPERATION_TIMEDOUT,
00022     PROXY_RESOLUTION_FAILURE,
00023     SSL_CONNECT_ERROR,
00024     SSL_LOCAL_CERTIFICATE_ERROR,
00025     SSL_REMOTE_CERTIFICATE_ERROR,
00026     SSL_CACERT_ERROR,
00027     GENERIC_SSL_ERROR,
00028     UNSUPPORTED_PROTOCOL,
00029     UNKNOWN_ERROR = 1000,
00030 };
00031 
00032 class Error {
00033   public:
00034     Error() : code{ErrorCode::OK} {}
00035 
00036     template <typename TextType>
00037     Error(const std::int32_t& curl_code, TextType&& p_error_message)
00038             : code{getErrorCodeForCurlError(curl_code)}, message{CPR_FWD(p_error_message)} {}
00039 
00040     explicit operator bool() const {
00041         return code != ErrorCode::OK;
00042     }
00043 
00044     ErrorCode code;
00045     std::string message;
00046 
00047   private:
00048     static ErrorCode getErrorCodeForCurlError(std::int32_t curl_code);
00049 };
00050 
00051 } // namespace cpr
00052 
00053 #endif


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:02