brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · cfac055 Raw
37 lines · cpp
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-exception6//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 14using namespace lldb_protocol::mcp;15 16char MCPError::ID;17char UnsupportedURI::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}37