FastEngine 0.9.5
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
C_error.hpp
1/*
2 * Copyright 2026 Guillaume Guillet
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 */
16
17#ifndef _FGE_C_ERROR_HPP_INCLUDED_
18#define _FGE_C_ERROR_HPP_INCLUDED_
19
20#include "FastEngine/fge_extern.hpp"
21#include <cstdint>
22#include <ostream>
23
24namespace fge::net
25{
26
27struct FGE_API Error
28{
29 enum class Types
30 {
31 ERR_ALREADY_INVALID,
32 ERR_EXTRACT,
33 ERR_RULE,
34 ERR_TRANSMIT,
35 ERR_DATA,
36
37 ERR_SCENE_OLD_PACKET
38 };
39
40 constexpr Error(Types type) :
41 _type(type)
42 {}
43 constexpr Error(Types type, std::size_t readPos, char const* error, char const* function) :
44 _type(type),
45 _readPos(readPos),
46 _error(error),
47 _function(function)
48 {}
49 constexpr Error(Types type, char const* error, char const* function) :
50 _type(type),
51 _error(error),
52 _function(function)
53 {}
54
55 Types _type;
56 std::size_t _readPos{0};
57 char const* _error{nullptr};
58 char const* _function{nullptr};
59
60 void dump(std::ostream& os) const;
61};
62
63} // namespace fge::net
64
65#endif // _FGE_C_ERROR_HPP_INCLUDED_