1 //===--------------- RPCError.cpp - RPCERror implementation ---------------===//
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
7 //===----------------------------------------------------------------------===//
9 // RPC Error type implmentations.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/ExecutionEngine/Orc/RPC/RPCUtils.h"
14 #include "llvm/Support/Error.h"
15 #include "llvm/Support/raw_ostream.h"
17 #include <system_error>
20 char llvm::orc::rpc::RPCFatalError::ID = 0;
21 char llvm::orc::rpc::ConnectionClosed::ID = 0;
22 char llvm::orc::rpc::ResponseAbandoned::ID = 0;
23 char llvm::orc::rpc::CouldNotNegotiate::ID = 0;
29 std::error_code ConnectionClosed::convertToErrorCode() const {
30 return orcError(OrcErrorCode::RPCConnectionClosed);
33 void ConnectionClosed::log(raw_ostream &OS) const {
34 OS << "RPC connection already closed";
37 std::error_code ResponseAbandoned::convertToErrorCode() const {
38 return orcError(OrcErrorCode::RPCResponseAbandoned);
41 void ResponseAbandoned::log(raw_ostream &OS) const {
42 OS << "RPC response abandoned";
45 CouldNotNegotiate::CouldNotNegotiate(std::string Signature)
46 : Signature(std::move(Signature)) {}
48 std::error_code CouldNotNegotiate::convertToErrorCode() const {
49 return orcError(OrcErrorCode::RPCCouldNotNegotiateFunction);
52 void CouldNotNegotiate::log(raw_ostream &OS) const {
53 OS << "Could not negotiate RPC function " << Signature;
57 } // end namespace rpc
58 } // end namespace orc
59 } // end namespace llvm