Shows how to use system_exception exception.
#include <xtd/xtd>
long create_handle() {
return reinterpret_cast<long>(new guid());
}
void destroy_handle(long handle) {
if (handle == 0) throw system_exception("The handle is null");
delete reinterpret_cast<object*>(handle);
}
auto main() -> int {
try {
destroy_handle(handle);
} catch (const system_exception& e) {
console::write_line("Exception occured :");
console::write_line("-------------------");
console::write_line(e);
}
}
xtd::intptr handle() noexcept
Gets the thread handle of the current thread.
@ l
The L key.
Definition console_key.hpp:110