|
12 | 12 | /** @file
|
13 | 13 | @brief ESP_CHECK macro, for use with fatal runtime errors.
|
14 | 14 |
|
15 |
| - Below is an overview of asserts, ESP_CHECK, exception-throwing, and warnings |
16 |
| - in Habitat-sim. These are new guidelines as of Feb 2021; not all Habitat code |
17 |
| - follows these guidelines yet. |
| 15 | + Below is an overview of asserts, ESP_CHECK vs. ESP_FATAL, exception-throwing, |
| 16 | + and warnings in Habitat-sim. These are new guidelines as of Feb 2021, and |
| 17 | + updated June 2023; not all Habitat code follows these guidelines yet. |
18 | 18 |
|
19 | 19 | assert
|
20 | 20 | - see CORRADE_ASSERT and CORRADE_ASSERT_INTERNAL.
|
|
51 | 51 | namespace esp {
|
52 | 52 | namespace core {
|
53 | 53 |
|
54 |
| -/** |
55 |
| - * @brief The throwInPython function pointer gets filled during Python bindings |
56 |
| - * startup. If it's nullptr, we're in plain C++ code. |
57 |
| - */ |
58 |
| -extern void (*throwInPython)(const char*); |
| 54 | +/* The throwRuntimeInPython function pointer gets filled during Python bindings |
| 55 | + startup. If it's nullptr, we're in plain C++ code. */ |
| 56 | +extern void (*throwRuntimeInPython)(const char*); |
59 | 57 |
|
60 |
| -/** |
61 |
| - * @brief For use in ESP_CHECK |
62 |
| - */ |
63 |
| -[[noreturn]] void throwIfInPythonOtherwiseAbort(const char* message); |
| 58 | +// For use in ESP_CHECK |
| 59 | +[[noreturn]] void throwIfInPythonOtherwiseExit(const char* message); |
64 | 60 |
|
65 | 61 | } // namespace core
|
66 | 62 | } // namespace esp
|
67 | 63 |
|
68 |
| -/** |
69 |
| - * @brief A runtime check that must pass, otherwise we consider this a fatal |
70 |
| - * runtime error. The program terminates with the supplied error message. |
71 |
| - */ |
| 64 | +/* A runtime check that must pass, otherwise we consider this a fatal |
| 65 | + * user-caused error (bad data). The program exist with the supplied error |
| 66 | + * message but no core dump. */ |
72 | 67 | #define ESP_CHECK(condition, ...) \
|
73 | 68 | do { \
|
74 | 69 | if (!(condition)) { \
|
75 | 70 | std::ostringstream out; \
|
76 | 71 | Corrade::Utility::Debug{ \
|
77 | 72 | &out, Corrade::Utility::Debug::Flag::NoNewlineAtTheEnd} \
|
78 | 73 | << "ESP_CHECK failed:" << __VA_ARGS__; \
|
79 |
| - esp::core::throwIfInPythonOtherwiseAbort(out.str().data()); \ |
| 74 | + esp::core::throwIfInPythonOtherwiseExit(out.str().data()); \ |
80 | 75 | } \
|
81 | 76 | } while (false)
|
82 | 77 |
|
|
0 commit comments