LLDB
mainline
llvm-project
lldb
source
Protocol
MCP
MCPError.cpp
Go to the documentation of this file.
1
//===----------------------------------------------------------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "
lldb/Protocol/MCP/MCPError.h
"
10
#include "llvm/Support/Error.h"
11
#include "llvm/Support/raw_ostream.h"
12
#include <system_error>
13
14
using namespace
lldb_protocol::mcp
;
15
16
char
MCPError::ID
;
17
char
UnsupportedURI::ID
;
18
19
MCPError::MCPError
(std::string message, int64_t error_code)
20
:
m_message
(message),
m_error_code
(error_code) {}
21
22
void
MCPError::log
(llvm::raw_ostream &OS)
const
{ OS <<
m_message
; }
23
24
std::error_code
MCPError::convertToErrorCode
()
const
{
25
return
std::error_code(
m_error_code
, std::generic_category());
26
}
27
28
UnsupportedURI::UnsupportedURI
(std::string uri) :
m_uri
(uri) {}
29
30
void
UnsupportedURI::log
(llvm::raw_ostream &OS)
const
{
31
OS <<
"unsupported uri: "
<<
m_uri
;
32
}
33
34
std::error_code
UnsupportedURI::convertToErrorCode
()
const
{
35
return
llvm::inconvertibleErrorCode();
36
}
MCPError.h
lldb_protocol::mcp::MCPError::m_error_code
int m_error_code
Definition
MCPError.h:33
lldb_protocol::mcp::MCPError::ID
static char ID
Definition
MCPError.h:19
lldb_protocol::mcp::MCPError::convertToErrorCode
std::error_code convertToErrorCode() const override
Definition
MCPError.cpp:24
lldb_protocol::mcp::MCPError::m_message
std::string m_message
Definition
MCPError.h:32
lldb_protocol::mcp::MCPError::log
void log(llvm::raw_ostream &OS) const override
Definition
MCPError.cpp:22
lldb_protocol::mcp::MCPError::MCPError
MCPError(std::string message, int64_t error_code=kInternalError)
Definition
MCPError.cpp:19
lldb_protocol::mcp::UnsupportedURI::log
void log(llvm::raw_ostream &OS) const override
Definition
MCPError.cpp:30
lldb_protocol::mcp::UnsupportedURI::ID
static char ID
Definition
MCPError.h:38
lldb_protocol::mcp::UnsupportedURI::m_uri
std::string m_uri
Definition
MCPError.h:46
lldb_protocol::mcp::UnsupportedURI::UnsupportedURI
UnsupportedURI(std::string uri)
Definition
MCPError.cpp:28
lldb_protocol::mcp::UnsupportedURI::convertToErrorCode
std::error_code convertToErrorCode() const override
Definition
MCPError.cpp:34
lldb_protocol::mcp
Definition
MCPError.h:15
Generated on
for LLDB by
1.14.0