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& frame = stack_frame::current()) : 
exception {
"The employee list does not exist."_t, frame} {
 
    }
    
    employee_list_not_found_exception(
const string& message, 
const stack_frame& frame = stack_frame::current()) : 
exception {message, frame} {
 
    }
    
    template<typename exception_t>
    employee_list_not_found_exception(
const string& message, 
const exception_t& inner, 
const stack_frame& frame = stack_frame::current()) : 
exception {message, inner, frame} {
 
    }
  };
}
 
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.hpp:47
 
Defines the base class for predefined exceptions in the xtd namespace.
Definition exception.hpp:28
 
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition assert_dialog_result.hpp:10
 
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10