aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/system/exit-inl.h
blob: e4fe8ea5940473f154d8c34156b51c93dc3f445b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef EXIT_INL_H_
#error "Direct inclusion of this file is not allowed, include exit.h"
// For the sake of sane code completion.
#include "exit.h"
#endif

namespace NYT {

////////////////////////////////////////////////////////////////////////////////

template <class E>
    requires std::is_enum_v<E>
[[noreturn]] void AbortProcessSilently(E exitCode)
{
    AbortProcessSilently(ToUnderlying(exitCode));
}

template <class E>
    requires std::is_enum_v<E>
[[noreturn]] void AbortProcessDramatically(
    E exitCode,
    TStringBuf message)
{
    AbortProcessDramatically(
        ToUnderlying(exitCode),
        TEnumTraits<E>::FindLiteralByValue(exitCode).value_or("<unknown>"),
        message);
}

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT