Indicates any problem that may have occurred during a request to an ms_http_helper object. More...
#include <ms_http_helper_return.hpp>
Public Types | |
enum | ErrorTypeCode { ERR_NONE , ERR_ABORTEDBYUSER , ERR_SYSTEM , ERR_HTTP , ERR_UNSPECIFIED } |
Definitions for types of problem that can be encountered. More... | |
Public Member Functions | |
ms_http_helper_return () | |
C++ STL collection support. | |
std::string | getErrorText () const |
Returns the text, if any, associated with the error. | |
ErrorTypeCode | getErrorType () const |
Returns type of any error that was encountered. | |
int | getHttpStatusCode () const |
Returns the HTTP response code (if the type is ERR_http). | |
int | getSystemError () const |
Returns the operating system error code for the problem (if the type is ERR_system). | |
bool | isOk () const |
Returns true if no problem was encountered. | |
operator bool () const | |
Returns the same value as the IsOk function. | |
Static Public Member Functions | |
static ms_http_helper_return | abortedByUser () |
Creates an object to indicate that the operation has been aborted at the request of the user. | |
static ms_http_helper_return | httpError (int httpStatusCode, std::string errorText) |
Creates an object with the specified HTTP response code (200 represents a success ). | |
static ms_http_helper_return | systemError (int systemError) |
Creates an object with the specified system error code. | |
static ms_http_helper_return | unspecifiedError () |
Creates an error object with no specific cause. | |
Indicates any problem that may have occurred during a request to an ms_http_helper object.
The soecific error information is returned to allow detailed or specific action to be taken in response. If no specific action is warranted then IsOk can be used to determine success or failure. Any failure will have been logged in the error handler for the ms_http_helper object.
enum ErrorTypeCode |
Definitions for types of problem that can be encountered.
See Using enumerated values and static const ints in Perl, Java, Python and C#.
C++ STL collection support.
STL collections, such as vector
need a default constructor.
|
static |
Creates an object to indicate that the operation has been aborted at the request of the user.
There is no text associated with this type of return.
std::string getErrorText | ( | ) | const |
Returns the text, if any, associated with the error.
The content depends on the type of error (see errorType()).
ms_http_helper_return::ErrorTypeCode getErrorType | ( | ) | const |
Returns type of any error that was encountered.
This can be ERR_NONE to indicate that there was no error.
int getHttpStatusCode | ( | ) | const |
Returns the HTTP response code (if the type is ERR_http).
The meanings of HTTP status codes are defined by the Internet Engineering Task Force (IETF) (e.g. 200 = OK).
int getSystemError | ( | ) | const |
Returns the operating system error code for the problem (if the type is ERR_system).
The meaning of the return code depends on the underlying operating system (e.g. Windows, Linux).
|
static |
Creates an object with the specified HTTP response code (200 represents a success ).
The error text will contain the descriptive text returned in the HTTP reply.
httpStatusCode | The number of the HTTP error encountered. |
httpStatusText | The text of the HTTP error encountered. |
bool isOk | ( | ) | const |
Returns true if no problem was encountered.
If this returns false, then errorType() can be used to determine the cause.
operator bool | ( | ) | const |
Returns the same value as the IsOk function.
If this returns false, then errorType() can be used to determine the cause.
|
static |
Creates an object with the specified system error code.
The error text will contain the operating system provided description for the error.
systemError | The number of the system error encountered. |
|
static |
Creates an error object with no specific cause.
There is no diagnostic information available for this type of error.