LLDB mainline
JSONTransport.cpp
Go to the documentation of this file.
1//===-- JSONTransport.cpp -------------------------------------------------===//
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 "lldb/Utility/Log.h"
11#include "lldb/Utility/Status.h"
12#include "llvm/ADT/StringExtras.h"
13#include "llvm/Support/raw_ostream.h"
14#include <string>
15
16using namespace llvm;
17using namespace lldb_private::transport;
18
20
22 std::string unhandled_contents)
23 : m_unhandled_contents(unhandled_contents) {}
24
25void TransportUnhandledContentsError::log(raw_ostream &OS) const {
26 OS << "transport EOF with unhandled contents: '" << m_unhandled_contents
27 << "'";
28}
30 return std::make_error_code(std::errc::bad_message);
31}
32
34
35void InvalidParams::log(raw_ostream &OS) const {
36 OS << "invalid parameters for method '" << m_method << "': '" << m_context
37 << "'";
38}
39std::error_code InvalidParams::convertToErrorCode() const {
40 return std::make_error_code(std::errc::invalid_argument);
41}
42
44
45void MethodNotFound::log(raw_ostream &OS) const {
46 OS << "method not found: '" << m_method << "'";
47}
48
49std::error_code MethodNotFound::convertToErrorCode() const {
50 // JSON-RPC Method not found
51 return std::error_code(MethodNotFound::kErrorCode, std::generic_category());
52}
std::error_code convertToErrorCode() const override
std::string m_context
Additional context from the parsing failure, e.g.
std::string m_method
The JSONRPC remote method call.
void log(llvm::raw_ostream &OS) const override
std::error_code convertToErrorCode() const override
void log(llvm::raw_ostream &OS) const override
void log(llvm::raw_ostream &OS) const override
TransportUnhandledContentsError(std::string unhandled_contents)