Debian Codegraph @

CodeLite/LSP/ResponseError.h

raw
1 #ifndef RESPONSEERROR_H
2 #define RESPONSEERROR_H
3
4 #include "codelite_exports.h"
5 #include "JSON.h"
6 #include "LSP/Message.h"
7
8 namespace LSP
9 {
10
11 class WXDLLIMPEXP_CL ResponseError : public Message
12 {
13 int m_errorCode = wxNOT_FOUND;
14 wxString m_message;
15
16 public:
17 enum eErrorCodes {
18 kErrorCodeParseError = -32700,
19 kErrorCodeInvalidRequest = -32600,
20 kErrorCodeMethodNotFound = -32601,
21 kErrorCodeInvalidParams = -32602,
22 kErrorCodeInternalError = -32603,
23 kErrorCodeserverErrorStart = -32099,
24 kErrorCodeserverErrorEnd = -32000,
25 kErrorCodeServerNotInitialized = -32002,
26 kErrorCodeUnknownErrorCode = -32001,
27 kErrorCodeRequestCancelled = -32800,
28 kErrorCodeContentModified = -32801,
29 };
30
31 public:
32 ResponseError(const wxString& message);
33 ResponseError();
34 virtual ~ResponseError();
35 void FromJSON(const JSONItem& json);
36 JSONItem ToJSON(const wxString& name) const;
37 virtual std::string ToString() const;
38 void SetErrorCode(int errorCode) { this->m_errorCode = errorCode; }
39 void SetMessage(const wxString& message) { this->m_message = message; }
40 int GetErrorCode() const { return m_errorCode; }
41 const wxString& GetMessage() const { return m_message; }
42 bool IsOk() const { return m_errorCode != wxNOT_FOUND; }
43 };
44
45 }; // namespace LSP
46
47 #endif // RESPONSEERROR_H