cpp-msgpack-rpc
0.2.0
An RPC library implementing MessagePack RPC.
Toggle main menu visibility
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
*/
20
#include "
msgpack_rpc/clients/server_exception.h
"
21
22
#include <string>
23
#include <utility>
24
25
#include <fmt/format.h>
26
27
#include "
msgpack_rpc/util/format_msgpack_object.h
"
28
29
namespace
msgpack_rpc::clients
{
30
31
ServerException::ServerException
(
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
39
const
msgpack::object&
ServerException::object
() const noexcept {
40
return
object_
;
41
}
42
43
ServerException::ServerException
(
const
ServerException
&)
noexcept
=
default
;
44
45
ServerException::ServerException
(
ServerException
&&) noexcept = default;
46
47
ServerException
&
ServerException
::operator=(
48
const
ServerException
&) noexcept = default;
49
50
ServerException
&
ServerException
::operator=(
51
ServerException
&&) noexcept = default;
52
53
ServerException
::~
ServerException
() noexcept = default;
54
55
}
// namespace msgpack_rpc::clients
msgpack_rpc::clients::ServerException
Class of exceptions specifying errors in servers.
Definition
server_exception.h:38
msgpack_rpc::clients::ServerException::ServerException
ServerException(msgpack::object object, std::shared_ptr< msgpack::zone > zone)
Constructor.
Definition
server_exception.cpp:31
msgpack_rpc::clients::ServerException::object_
msgpack::object object_
Object in msgpack library specifying the error.
Definition
server_exception.h:107
msgpack_rpc::clients::ServerException::zone_
std::shared_ptr< msgpack::zone > zone_
Zone in msgpack library.
Definition
server_exception.h:104
msgpack_rpc::clients::ServerException::object
const msgpack::object & object() const noexcept
Get the object in msgpack library.
Definition
server_exception.cpp:39
msgpack_rpc::MsgpackRPCException
Class of exceptions in cpp-msgpack-rpc library.
Definition
msgpack_rpc_exception.h:35
format_msgpack_object.h
Definition of format_msgpack_object function.
fmt
Namespace of fmt library.
Definition
uri.h:113
msgpack_rpc::clients
Namespace of clients.
Definition
call_future.h:30
msgpack_rpc::common::StatusCode
StatusCode
Enumeration of status codes.
Definition
status_code.h:33
msgpack_rpc::util
Namespace of utilities.
Definition
format_msgpack_object.h:27
std
STL namespace.
server_exception.h
Definition of ServerException class.
src
msgpack_rpc
clients
server_exception.cpp
Generated on
for cpp-msgpack-rpc by
1.18.0