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 std::error_code(m_error_code, std::generic_category());
26}
27
28UnsupportedURI::UnsupportedURI(std::string uri) : m_uri(uri) {}
29
30void UnsupportedURI::log(llvm::raw_ostream &OS) const {
31 OS << "unsupported uri: " << m_uri;
32}
33
34std::error_code UnsupportedURI::convertToErrorCode() const {
35 return llvm::inconvertibleErrorCode();
36}
std::error_code convertToErrorCode() const override
Definition MCPError.cpp:24
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:30
std::error_code convertToErrorCode() const override
Definition MCPError.cpp:34