LLDB mainline
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
10#include "llvm/Support/Error.h"
11#include "llvm/Support/raw_ostream.h"
12#include <system_error>
13
14using namespace lldb_protocol::mcp;
15
16char MCPError::ID;
18
19MCPError::MCPError(std::string message, int64_t error_code)
20 : m_message(message), m_error_code(error_code) {}
21
22void MCPError::log(llvm::raw_ostream &OS) const { OS << m_message; }
23
24std::error_code MCPError::convertToErrorCode() const {
25 return llvm::inconvertibleErrorCode();
26}
27
34
35UnsupportedURI::UnsupportedURI(std::string uri) : m_uri(uri) {}
36
37void UnsupportedURI::log(llvm::raw_ostream &OS) const {
38 OS << "unsupported uri: " << m_uri;
39}
40
41std::error_code UnsupportedURI::convertToErrorCode() const {
42 return llvm::inconvertibleErrorCode();
43}
static llvm::raw_ostream & error(Stream &strm)
std::error_code convertToErrorCode() const override
Definition MCPError.cpp:24
lldb_protocol::mcp::Error toProtocolError() const
Definition MCPError.cpp:28
void log(llvm::raw_ostream &OS) const override
Definition MCPError.cpp:22
MCPError(std::string message, int64_t error_code=kInternalError)
Definition MCPError.cpp:19
void log(llvm::raw_ostream &OS) const override
Definition MCPError.cpp:37
std::error_code convertToErrorCode() const override
Definition MCPError.cpp:41