HttpError.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
10 #include <BeHttp/HttpResponse.h>
11 #include <BeHttp/Http.h>
13 
15 
16 /*--------------------------------------------------------------------------------------+
17 * @bsiclass Bentley Systems
18 +---------------+---------------+---------------+---------------+---------------+------*/
19 struct EXPORT_VTABLE_ATTRIBUTE HttpError : Tasks::AsyncError
20 {
21 private:
22  ConnectionStatus m_connectionStatus;
23  HttpStatus m_httpStatus;
24 
25  BEHTTP_EXPORT static Utf8String CreateDescription(ConnectionStatus connectionStatus, HttpStatus httpStatus);
26  BEHTTP_EXPORT static Utf8String CreateMessage(ConnectionStatus connectionStatus, HttpStatus httpStatus);
27 
28 public:
30  HttpError(Response httpResponse) : HttpError(httpResponse.GetConnectionStatus(), httpResponse.GetHttpStatus()) {}
31  HttpError(ConnectionStatus connectionStatus, HttpStatus httpStatus) : m_connectionStatus(connectionStatus), m_httpStatus(httpStatus),
32  AsyncError(CreateMessage(connectionStatus, httpStatus), CreateDescription(connectionStatus, httpStatus)){}
33 
34  ConnectionStatus GetConnectionStatus() const {return m_connectionStatus;}
35  HttpStatus GetHttpStatus() const {return m_httpStatus;}
36 
38  virtual Utf8String GetDisplayMessage() const {return m_message;}
39 
41  BEHTTP_EXPORT virtual Utf8String GetDisplayDescription() const;
42 
43  BEHTTP_EXPORT static Utf8String GetConnectionErrorDisplayMessage(ConnectionStatus connectionStatus);
44  BEHTTP_EXPORT static Utf8String GetHttpDisplayMessage(HttpStatus httpStatus);
45 };
46 
#define BEGIN_BENTLEY_HTTP_NAMESPACE
Definition: Http.h:17
HttpError(Response httpResponse)
Definition: HttpError.h:30
HttpError()
Definition: HttpError.h:29
#define BEHTTP_EXPORT
Definition: Http.h:14
HttpStatus
Definition: HttpStatus.h:14
HttpStatus GetHttpStatus() const
Definition: HttpError.h:35
Definition: HttpError.h:19
virtual Utf8String GetDisplayMessage() const
DEPRECATED - use GetMessage()
Definition: HttpError.h:38
Definition: HttpResponse.h:60
ConnectionStatus GetConnectionStatus() const
Definition: HttpError.h:34
#define END_BENTLEY_HTTP_NAMESPACE
Definition: Http.h:18
HttpError(ConnectionStatus connectionStatus, HttpStatus httpStatus)
Definition: HttpError.h:31
ConnectionStatus
Definition: HttpResponse.h:27
#define EXPORT_VTABLE_ATTRIBUTE
Definition: Bentley.h:67

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.