The STXXL provides several pre-defined exception macros to detect run-time errors. The basic ones are:
- STXXL_THROW(exception_type, error_message)
- STXXL_THROW2(exception_type, location, error_message)
- STXXL_THROW_ERRNO(exception_type, error_message)
- STXXL_THROW_INVALID_ARGUMENT(error_message)
- STXXL_THROW_UNREACHABLE(error_message)
In addition, we also defined conditional throw macros, which check the outcome of a function call:
- STXXL_THROW_IF(expr, exception_type, error_message)
- STXXL_THROW_NE_0(expr, exception_type, error_message)
- STXXL_THROW_EQ_0(expr, exception_type, error_message)
- STXXL_THROW_LT_0(expr, exception_type, error_message)
For checking system calls which set errno, the following macros are used to also provide strerror information for the user:
- STXXL_THROW_ERRNO_IF(expr, exception_type, error_message)
- STXXL_THROW_ERRNO_NE_0(expr, exception_type, error_message)
- STXXL_THROW_ERRNO_EQ_0(expr, exception_type, error_message)
- STXXL_THROW_ERRNO_LT_0(expr, exception_type, error_message)
For checking pthread system calls, a special macro is needed, because these do not set errno. Instead they return the errno value:
- STXXL_CHECK_PTHREAD_CALL(pthread call)
And for WINAPI calls there is a special macro to call GetLastError and format it in a nice way:
- STXXL_THROW_WIN_LASTERROR(exception_type, error_message)