#include "farm_ng/core/logging/logger.h"
#include <tl/expected.hpp>
#include <iostream>
#include <optional>
#include <string>
#include <vector>
Go to the source code of this file.
◆ FARM_ASSERT_OR_ERROR
#define FARM_ASSERT_OR_ERROR |
( |
|
condition, |
|
|
|
... |
|
) |
| |
Value: if (!(condition)) { \
"bool({}) not true.\n{}", #condition,
FARM_FORMAT(__VA_ARGS__)); \
} \
do { \
} while (false)
◆ FARM_ERROR_DETAIL
#define FARM_ERROR_DETAIL |
( |
|
... | ) |
|
◆ FARM_ERROR_REPORT
#define FARM_ERROR_REPORT |
( |
|
cstr, |
|
|
|
... |
|
) |
| |
◆ FARM_TRY
#define FARM_TRY |
( |
|
Type, |
|
|
|
var, |
|
|
|
expression |
|
) |
| |
Value: auto maybe##var = (expression); \
if (!maybe##var) { \
auto error = maybe##var.error(); \
error.details.emplace_back( \
return ::tl::make_unexpected(error); \
} \
Type var = ::std::move(*maybe##var);
Assigns *expression
to var
of Type
, but returns error if there is one.
◆ FARM_UNEXPECTED
#define FARM_UNEXPECTED |
( |
|
cstr, |
|
|
|
... |
|
) |
| ::tl::make_unexpected(FARM_ERROR_REPORT(cstr, ##__VA_ARGS__)) |