|
1 | 1 | #pragma once |
2 | 2 |
|
| 3 | +#include "engine/EngineOwnData.h" |
| 4 | +#include "ll/api/utils/ErrorUtils.h" |
3 | 5 | #include "lse/Entry.h" |
4 | 6 | #include "main/Global.h" |
| 7 | +#include "mc/world/level/Level.h" |
5 | 8 | #include "utils/JsonHelper.h" |
6 | 9 | #include "utils/UsingScriptX.h" |
7 | | -#include "engine/EngineOwnData.h" |
8 | | -#include "ll/api/utils/ErrorUtils.h" |
9 | | -#include "mc/world/level/Level.h" |
10 | 10 |
|
11 | | -#include <string> |
12 | 11 | #include <exception> |
13 | 12 | #include <magic_enum.hpp> |
| 13 | +#include <string> |
14 | 14 |
|
15 | 15 | // 实例类类型检查 |
16 | 16 | template <typename T> |
@@ -189,33 +189,39 @@ inline void LOG_WRONG_ARGS_COUNT(std::string const& func = {}) { |
189 | 189 |
|
190 | 190 | #define CHECK_ARGS_LEAST_COUNT(count) \ |
191 | 191 | if (args.size() < count) { \ |
192 | | - throw Exception(fmt::format( \ |
193 | | - "Invalid arguments count: {}, expect at least {}, in API {}", \ |
194 | | - args.size(), \ |
195 | | - count, \ |
196 | | - __FUNCTION__ \ |
197 | | - )); \ |
| 192 | + throw Exception( \ |
| 193 | + fmt::format( \ |
| 194 | + "Invalid arguments count: {}, expect at least {}, in API {}", \ |
| 195 | + args.size(), \ |
| 196 | + count, \ |
| 197 | + __FUNCTION__ \ |
| 198 | + ) \ |
| 199 | + ); \ |
198 | 200 | } |
199 | 201 |
|
200 | 202 | #define CHECK_ARG_TYPE(index, type) \ |
201 | 203 | if (args[index].getKind() != ValueKind::type) { \ |
202 | | - throw Exception(fmt::format( \ |
203 | | - "Wrong type of arguments[{}]: {}, expect {}, in API {}", \ |
204 | | - index, \ |
205 | | - ValueKindToString(args[index].getKind()), \ |
206 | | - ValueKindToString(ValueKind::type), \ |
207 | | - __FUNCTION__ \ |
208 | | - )); \ |
| 204 | + throw Exception( \ |
| 205 | + fmt::format( \ |
| 206 | + "Wrong type of arguments[{}]: {}, expect {}, in API {}", \ |
| 207 | + index, \ |
| 208 | + ValueKindToString(args[index].getKind()), \ |
| 209 | + ValueKindToString(ValueKind::type), \ |
| 210 | + __FUNCTION__ \ |
| 211 | + ) \ |
| 212 | + ); \ |
209 | 213 | } |
210 | 214 |
|
211 | 215 | #define CHECK_VAL_TYPE(val, type) \ |
212 | 216 | if (val.getKind() != ValueKind::type) { \ |
213 | | - throw Exception(fmt::format( \ |
214 | | - "Wrong type of value: {}, expect {}, in API {}", \ |
215 | | - ValueKindToString(val.getKind()), \ |
216 | | - ValueKindToString(ValueKind::type), \ |
217 | | - __FUNCTION__ \ |
218 | | - )); \ |
| 217 | + throw Exception( \ |
| 218 | + fmt::format( \ |
| 219 | + "Wrong type of value: {}, expect {}, in API {}", \ |
| 220 | + ValueKindToString(val.getKind()), \ |
| 221 | + ValueKindToString(ValueKind::type), \ |
| 222 | + __FUNCTION__ \ |
| 223 | + ) \ |
| 224 | + ); \ |
219 | 225 | } |
220 | 226 |
|
221 | 227 | #endif |
|
0 commit comments