2 * Copyright (C) 2013 HERE Global B.V. All rights reserved.
3 * This software, including documentation, is protected by copyright controlled by
4 * HERE Global B.V. (“Software”). All rights are reserved. Copying, including reproducing,
5 * storing, adapting or translating, any or all of this material requires the prior
6 * written consent of HERE Global B.V. You may use this
7 * Software in accordance with the terms and conditions defined in the
8 * HERE Location Platform Services Terms and Conditions, available at
9 * http://developer.here.com/terms-conditions-base
11 * As an additional permission to the above, you may distribute Software,
12 * in object code format as part of an Application, according to, and subject to, terms and
13 * conditions defined in the Tizen Software Development kit (“SDK”) License Agreement.
14 * You may distribute such object code format Application under terms of your choice,
15 * provided that the header and source files of the Software have not been modified.
18 #ifndef COMMUNICATIONERROR_H
19 #define COMMUNICATIONERROR_H
21 #include "common/HereMaps_global.h"
22 #include "common/ErrorBase.h"
24 #ifndef TIZEN_MIGRATION
28 HERE_MAPS_BEGIN_NAMESPACE
31 * This class encapsulates information about an error condition that may arise
32 * in network communications between the client and the server.
34 class EXPORT_API CommunicationError : public ErrorBase
38 * This enumeration defines error code identifiers.
42 CE_HttpError, ///< Indicates an HTTP error.
43 CE_NetworkError, ///< Indicates a network error.
44 CE_RestEngineError, ///< Indicates a REST engine error.
45 CE_MaxRequests ///< Indicates that the maximum number of requests
50 * This typedef defines a HTTP status code as a type.
52 #ifdef TIZEN_MIGRATION
53 typedef long HttpStatusCode;
55 typedef Tizen::Net::Http::NetHttpStatusCode HttpStatusCode;
59 * This method is a constructor.
61 * @param aErrorCode A value representing an error code.
63 CommunicationError(ErrorCode aErrorCode);
66 * This method is a constructor.
68 * @param aHttpStatusCode A value representing an HTTP status code as
69 * defined on http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
71 CommunicationError(HttpStatusCode aHttpStatusCode);
74 * This method is a (virtual) destructor.
77 virtual ~CommunicationError();
80 * This method retrieves an error code.
82 * @return A value representing an error code.
84 ErrorCode GetErrorCode() const;
87 * This method retrieves a string representation of the given instance of
88 * <code>CommunicationError</code>.
90 * @return A string representation of the given instance of
91 * <code>CommunicationError</code>.
93 virtual String ToString() const;
96 * This method sets an HTTP status code.
98 * @param aHttpStatusCode A value representing an HTTP status code as
99 * defined on http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
101 void SetHttpStatusCode(HttpStatusCode aHttpStatusCode);
103 #ifdef TIZEN_MIGRATION
105 * This method retrieves the HTTP status code associated with the given
106 * instance of the class.
108 * @return aHttpStatusCode A value representing an HTTP status code as
109 * defined on http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
111 const HttpStatusCode GetHttpStatusCode();
115 * This method associates a text string describing an error with the given
116 * instance of the class.
118 * @param sDesc A constant reference to a string containing the error
121 void SetErrorDescription(const String& sDesc);
124 * This method retrieves the error description associated with the given
125 * instance of the class.
127 * @return A constant reference to a string containing the error
130 const String& GetErrorDescription() const;
133 HERE_MAPS_NO_COPY_NO_ASSIGN(CommunicationError);
135 class CommunicationErrorImpl;
136 CommunicationErrorImpl* m_pImpl;
140 HERE_MAPS_END_NAMESPACE