Shows how to use xtd::exception exception.
#include <xtd/console>
#include <xtd/exception>
namespace user_defined_exception {
class employee_list_not_found_exception :
public exception {
public:
employee_list_not_found_exception(
const stack_frame& sf = stack_frame::current()) :
exception {
"The employee list does not exist."_t, sf} {
}
employee_list_not_found_exception(
const string& message,
const stack_frame& sf = stack_frame::current()) :
exception {message, sf} {
}
template<typename exception_t>
employee_list_not_found_exception(
const string& message,
const exception_t& inner,
const stack_frame& sf = stack_frame::current()) :
exception {message, inner, sf} {
}
};
}
auto main() -> int {
try {
throw user_defined_exception::employee_list_not_found_exception {};
console::write_line(
"type = {}",
e.get_type());
console::write_line(
"help_link = {}",
e.help_link());
console::write_line(
"h_result = 0x{0:X8} ({0})",
static_cast<uint
>(
e.h_result()));
console::write_line(
"inner_exception = {}",
e.inner_exception());
console::write_line(
"message = {}",
e.message());
console::write_line(
"source = {}",
e.source());
console::write_line(
"stack_trace = {}",
e.stack_trace());
}
}
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:47
Defines the base class for predefined exceptions in the xtd namespace.
Definition exception.h:28
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition assert_dialog_result.h:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10