Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Protocol/MCP/MCPError.cpp
213845 views
//===-- MCPError.cpp ------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "MCPError.h"9#include "llvm/Support/Error.h"10#include "llvm/Support/raw_ostream.h"11#include <system_error>1213namespace lldb_private::mcp {1415char MCPError::ID;16char UnsupportedURI::ID;1718MCPError::MCPError(std::string message, int64_t error_code)19: m_message(message), m_error_code(error_code) {}2021void MCPError::log(llvm::raw_ostream &OS) const { OS << m_message; }2223std::error_code MCPError::convertToErrorCode() const {24return llvm::inconvertibleErrorCode();25}2627protocol::Error MCPError::toProtcolError() const {28protocol::Error error;29error.error.code = m_error_code;30error.error.message = m_message;31return error;32}3334UnsupportedURI::UnsupportedURI(std::string uri) : m_uri(uri) {}3536void UnsupportedURI::log(llvm::raw_ostream &OS) const {37OS << "unsupported uri: " << m_uri;38}3940std::error_code UnsupportedURI::convertToErrorCode() const {41return llvm::inconvertibleErrorCode();42}4344} // namespace lldb_private::mcp454647