Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
try_catch_shim.hpp
Go to the documentation of this file.
1#pragma once
3#include <string>
4
5// Tool to make header only libraries (i.e. CLI11 and msgpack, though it has a bundled copy)
6// not use exceptions with minimally invaslive changes
7
8#ifdef BB_NO_EXCEPTIONS
9struct __AbortStream {
10 void operator<< [[noreturn]] (const auto& error)
11 {
12 info(error.what());
13 std::abort();
14 }
15};
16#define THROW __AbortStream() <<
17#define try if (true)
18#define catch(...) if (false)
19#define RETHROW
20#else
21#define THROW throw
22#define RETHROW THROW
23#endif
void info(Args... args)
Definition log.hpp:70