cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
server_exception.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2023 MusicScience37 (Kenta Kabashima)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
21
22#include <string>
23#include <utility>
24
25#include <fmt/format.h>
26
28
29namespace msgpack_rpc::clients {
30
32 msgpack::object object, std::shared_ptr<msgpack::zone> zone)
33 : MsgpackRPCException(StatusCode::SERVER_ERROR,
34 fmt::format(
35 "An error in a server: {}", util::format_msgpack_object(object))),
36 zone_(std::move(zone)),
37 object_(object) {}
38
39const msgpack::object& ServerException::object() const noexcept {
40 return object_;
41}
42
43ServerException::ServerException(const ServerException&) noexcept = default;
44
46
48 const ServerException&) noexcept = default;
49
51 ServerException&&) noexcept = default;
52
53ServerException::~ServerException() noexcept = default;
54
55} // namespace msgpack_rpc::clients
Class of exceptions specifying errors in servers.
ServerException(msgpack::object object, std::shared_ptr< msgpack::zone > zone)
Constructor.
msgpack::object object_
Object in msgpack library specifying the error.
std::shared_ptr< msgpack::zone > zone_
Zone in msgpack library.
const msgpack::object & object() const noexcept
Get the object in msgpack library.
Class of exceptions in cpp-msgpack-rpc library.
Definition of format_msgpack_object function.
Namespace of fmt library.
Definition uri.h:113
Namespace of clients.
Definition call_future.h:30
StatusCode
Enumeration of status codes.
Definition status_code.h:33
Namespace of utilities.
STL namespace.
Definition of ServerException class.