Thoth
A functional, expressive, asynchronous C++26 webdev library
Loading...
Searching...
No Matches
RequestError.hpp
Go to the documentation of this file.
1#pragma once
2#include <Hermes/_base/ConnectionErrorEnum.hpp>
3
5
6#include <vector>
7
8
9namespace Thoth::Http {
11 size_t idx;
12 char c;
13 };
14
20 std::vector<NJson::Key> currentPath;
21 };
23 };
25 template<class T>
26 static constexpr size_t IndexOf{};
27
28 size_t idxExpected{};
29 size_t idxGot{};
30 };
31
32 // TODO: FUTURE: high obscure, change to some fancy way in the future, but that will do
33 // std::variant<Null, String, Number, Bool, Object, Array>;
34 template<> constexpr size_t JsonWrongTypeError::IndexOf<NJson::Null >{ 0 };
35 template<> constexpr size_t JsonWrongTypeError::IndexOf<NJson::String>{ 1 };
36 template<> constexpr size_t JsonWrongTypeError::IndexOf<NJson::Number>{ 2 };
37 template<> constexpr size_t JsonWrongTypeError::IndexOf<NJson::Bool >{ 3 };
38 template<> constexpr size_t JsonWrongTypeError::IndexOf<NJson::Object>{ 4 };
39 template<> constexpr size_t JsonWrongTypeError::IndexOf<NJson::Array >{ 5 };
40
47
48 using ConnectionErrorEnum = Hermes::ConnectionErrorEnum;
49
56
57 struct GenericError {
58 std::string error{};
59 };
60
61 struct RequestError : std::variant<
62 JsonParseError,
63 JsonGetError,
64 JsonFindError,
65 JsonSearchError,
66 JsonWrongTypeError,
67 UrlParseErrorEnum,
68 ConnectionErrorEnum,
69 RequestBuildErrorEnum,
70 GenericError
71 > { // first time I'm using inheritance in the project lol
72 };
73}
74
75#include <Thoth/Http/RequestError.tpp>
Definition Client.hpp:12
UrlParseErrorEnum
Definition RequestError.hpp:41
Hermes::ConnectionErrorEnum ConnectionErrorEnum
Definition RequestError.hpp:48
RequestBuildErrorEnum
Definition RequestError.hpp:50
std::variant< int, JsonObjKey > Key
Definition Definitions.hpp:71
Definition RequestError.hpp:57
std::string error
Definition RequestError.hpp:58
Definition RequestError.hpp:18
std::vector< NJson::Key > currentPath
Definition RequestError.hpp:20
NJson::Key key
Definition RequestError.hpp:19
Definition RequestError.hpp:15
NJson::Key key
Definition RequestError.hpp:16
Definition RequestError.hpp:10
char c
Definition RequestError.hpp:12
size_t idx
Definition RequestError.hpp:11
Definition RequestError.hpp:22
Definition RequestError.hpp:24
size_t idxExpected
Definition RequestError.hpp:28
static constexpr size_t IndexOf
Definition RequestError.hpp:26
size_t idxGot
Definition RequestError.hpp:29
Definition RequestError.hpp:71