[Lldb-commits] [lldb] [lldb] Adding A new Binding helper for	JSONTransport. (PR #159160)
    Jonas Devlieghere via lldb-commits 
    lldb-commits at lists.llvm.org
       
    Fri Sep 19 11:59:29 PDT 2025
    
    
  
================
@@ -50,17 +58,54 @@ class TransportUnhandledContentsError
   std::string m_unhandled_contents;
 };
 
+/// An error to indicate that the parameters of a Req, Resp or Evt could not be
+/// deserialized.
+class InvalidParams : public llvm::ErrorInfo<InvalidParams> {
+public:
+  static char ID;
+
+  explicit InvalidParams(std::string method, std::string context)
+      : m_method(std::move(method)), m_context(std::move(context)) {}
+
+  void log(llvm::raw_ostream &OS) const override;
+  std::error_code convertToErrorCode() const override;
+
+private:
+  std::string m_method;
+  std::string m_context;
+};
+
+/// An error to indicate that no handler was registered for a given method.
+class MethodNotFound : public llvm::ErrorInfo<MethodNotFound> {
+public:
+  static char ID;
+
+  static constexpr int kErrorCode = -32601;
+
+  explicit MethodNotFound(std::string method) : m_method(std::move(method)) {}
+
+  void log(llvm::raw_ostream &OS) const override;
+  std::error_code convertToErrorCode() const override;
+
+private:
+  std::string m_method;
+};
+
 /// A transport is responsible for maintaining the connection to a client
 /// application, and reading/writing structured messages to it.
 ///
-/// Transports have limited thread safety requirements:
+/// JSONTransport have limited thread safety requirements:
----------------
JDevlieghere wrote:
```suggestion
/// JSONTransports have limited thread safety guarantees:
```
or 
```suggestion
/// JSONTransport has limited thread safety guarantees:
```
https://github.com/llvm/llvm-project/pull/159160
    
    
More information about the lldb-commits
mailing list