Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Protocol/MCP/MCPError.h
213845 views
//===-- MCPError.h --------------------------------------------------------===//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 "Protocol.h"9#include "llvm/Support/Error.h"10#include "llvm/Support/FormatVariadic.h"11#include <string>1213namespace lldb_private::mcp {1415class MCPError : public llvm::ErrorInfo<MCPError> {16public:17static char ID;1819MCPError(std::string message, int64_t error_code = kInternalError);2021void log(llvm::raw_ostream &OS) const override;22std::error_code convertToErrorCode() const override;2324const std::string &getMessage() const { return m_message; }2526protocol::Error toProtcolError() const;2728static constexpr int64_t kResourceNotFound = -32002;29static constexpr int64_t kInternalError = -32603;3031private:32std::string m_message;33int64_t m_error_code;34};3536class UnsupportedURI : public llvm::ErrorInfo<UnsupportedURI> {37public:38static char ID;3940UnsupportedURI(std::string uri);4142void log(llvm::raw_ostream &OS) const override;43std::error_code convertToErrorCode() const override;4445private:46std::string m_uri;47};4849} // namespace lldb_private::mcp505152