13#define sigjmp_buf jmp_buf
14#define sigsetjmp(jb, savemask) setjmp(jb)
15#define siglongjmp longjmp
18using Hook = std::function<void(
int)>;
24 std::string status_message =
"";
36 custom_error_state_ = state;
43 if (custom_error_state_)
44 return *custom_error_state_;
54int &get_status_code();
55std::string &get_status_message();
56sigjmp_buf &get_sigjmp_buf_point();
57std::mutex &get_sigint_hook_mutex();
58sigjmp_buf* get_current_jump_point_ptr();
59void set_current_jump_point(sigjmp_buf* jump_point);
60std::vector<Hook> &get_sigint_hooks();
62void fail(std::string message,
int code = 1);
63void handle_exception(
int code = -1);
64sigjmp_buf &get_jump_point();
66BOOL WINAPI console_ctrl_handler(DWORD ctrl_type);
68void handle_signal(
int sig, siginfo_t *,
void *);
70void set_error_handlers(
bool crash_handlers =
true,
bool sigint_handlers =
true);
72void crash_signal_handler(
int sig);
73void sigint_signal_handler(
int sig);
74void register_sigint_hook(Hook hook);
Error state registry for managing shared error state.
static void inject_error_state(ErrorState *state)
Inject a custom error state instance.
static ErrorState & get_error_state()
Get the error state instance.
Error state container for sharing between libraries.