Matrix Science header
Public Types | Public Member Functions | Static Public Member Functions

ms_http_helper_return Class Reference
[Accessing a Mascot Server using HTTP]

Indicates any problem that may have occurred during a request to an ms_http_helper object. More...

#include <ms_http_helper_return.hpp>

List of all members.

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.

Detailed Description

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.

Examples:

http_helper_getstring.cpp.


Member Enumeration Documentation

Definitions for types of problem that can be encountered.

See Using enumerated values in Perl, Java, Python and C#.

Enumerator:
ERR_NONE 

No problem was encountered; the operation completed successfully.

ERR_ABORTEDBYUSER 

The operation was aborted prematurely at the request of the operator.

ERR_SYSTEM 

A problem was found with one of the operating system functions.

ERR_HTTP 

A problem was reported via the HTTP channel.

ERR_UNSPECIFIED 

An error that was not categorised as one of the more specific types.


Constructor & Destructor Documentation

C++ STL collection support.

STL collections, such as vector need a default constructor.


Member Function Documentation

ms_http_helper_return abortedByUser (  ) [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.

Returns:
An object representing the fact that the task was aborted ath the request of the user.
std::string getErrorText (  ) const

Returns the text, if any, associated with the error.

The content depends on the type of error (see errorType()).

Returns:
The text for the error/reply represented.
Examples:
http_helper_getstring.cpp.
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.

Returns:
The type of return that this represents.
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).

Returns:
The HTTP reply code encountered.
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).

Returns:
The system error code encountered.
ms_http_helper_return httpError ( int  httpStatusCode,
std::string  httpStatusText 
) [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.

Parameters:
httpStatusCodeThe number of the HTTP error encountered.
httpStatusTextThe text of the HTTP error encountered.
Returns:
An object representing the given HTTP error.
bool isOk (  ) const

Returns true if no problem was encountered.

If this returns false, then errorType() can be used to determine the cause.

Returns:
True if this does not represent any type of error.
Examples:
http_helper_getstring.cpp.
operator bool (  ) const

Returns the same value as the IsOk function.

If this returns false, then errorType() can be used to determine the cause.

Returns:
True if this does not represent any type of error.
ms_http_helper_return systemError ( int  systemError ) [static]

Creates an object with the specified system error code.

The error text will contain the operating system provided description for the error.

Parameters:
systemErrorThe number of the system error encountered.
Returns:
An object representing the given system error.
ms_http_helper_return unspecifiedError (  ) [static]

Creates an error object with no specific cause.

There is no diagnostic information available for this type of error.

Returns:
An object representing a non-specific error.

The documentation for this class was generated from the following files:
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:52