xtd 0.2.0
Loading...
Searching...
No Matches
xtd::exception Class Reference
Inheritance diagram for xtd::exception:
xtd::object xtd::system_exception xtd::tunit::abort_error xtd::tunit::assert_error xtd::tunit::ignore_error xtd::argument_exception xtd::arithmetic_exception xtd::collections::generic::key_not_found_exception xtd::collections::key_not_found_exception xtd::domain_exception xtd::format_exception xtd::globalization::culture_not_found_exception xtd::index_out_of_range_exception xtd::interrupt_exception xtd::invalid_cast_exception xtd::invalid_operation_exception xtd::invalid_program_exception xtd::io::io_exception xtd::length_exception xtd::net::sockets::socket_exception xtd::not_implemented_exception xtd::not_supported_exception xtd::null_pointer_exception xtd::object_closed_exception xtd::operation_canceled_exception xtd::out_of_memory_exception xtd::rank_exception xtd::security::security_exception xtd::software_termination_exception xtd::threading::abandoned_mutex_exception xtd::threading::barrier_post_phase_exception xtd::threading::lock_recursion_exception xtd::threading::semaphore_full_exception xtd::threading::synchronization_lock_exception xtd::threading::thread_abort_exception xtd::threading::thread_interrupted_exception xtd::threading::thread_state_exception xtd::threading::wait_handle_cannot_be_opened_exception xtd::time_zone_not_found_exception xtd::timeout_exception xtd::unauthorized_access_exception xtd::uri_template_match_exception xtd::xml_syntax_exception

Definition

Defines the base class for predefined exceptions in the xtd namespace.

Namespace
xtd
Library
xtd.core
Examples
format_exception.cpp.

Public Aliases

using exception_ref
 Optional reference wrapper on std::exception.

Public Constructors

 exception (const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Create a new instance of class exception.
 exception (const xtd::optional< xtd::string > &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Create a new instance of class exception.
template<typename exception_t>
 exception (const xtd::optional< xtd::string > &message, const exception_t &inner_exception, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Create a new instance of class exception.

Public Properties

virtual auto help_link () const noexcept -> const xtd::string &
 Gets a link to the help file associated with this exception.
virtual auto help_link (const xtd::string &value) noexcept -> void
 Sets a link to the help file associated with this exception.
virtual auto h_result () const noexcept -> xtd::int32
 Gets HRESULT, a coded numerical value that is assigned to a specific exception.
virtual auto h_result (xtd::int32 value) noexcept -> void
 Sets HRESULT, a coded numerical value that is assigned to a specific exception.
virtual auto error_code () const noexcept -> const std::error_code &
 Gets error associate to the exception.
virtual auto error_code (const std::error_code &value) noexcept -> void
 Sets error associate to the exception.
virtual auto inner_exception () const noexcept -> exception_ref
 Gets the exception instance that caused the current exception.
virtual auto message () const noexcept -> const xtd::string &
 Gets message associate to the exception.
virtual auto source () const noexcept -> const xtd::string &
 Gets the name of the application or the object that causes the error.
virtual auto source (const xtd::string &value) noexcept -> void
 Sets the name of the application or the object that causes the error.
virtual auto stack_trace () const noexcept -> xtd::string
 Gets a string representation of the immediate frames on the call stack.

Public Methods

virtual auto get_last_stack_frame () const noexcept -> const xtd::diagnostics::stack_frame &
 Gets the last stack frame where the exception occurred.
auto to_string () const noexcept -> xtd::string override
 Returns a string that represents the current exception.
auto what () const noexcept -> const char *override
 Gets message associate to the exception.

Public Static Methods

static auto enable_stack_trace () noexcept -> bool
 Gets if the generation of the stack trace is enabled.
static auto enable_stack_trace (bool enable) noexcept -> void
 Sets if the generation of the stack trace is enabled. @paran enable triue if stack trace enabled; otherwise false.

Additional Inherited Members

 object ()=default
 Create a new instance of the ultimate base class object.
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
virtual xtd::usize get_hash_code () const noexcept
 Serves as a hash function for a particular type.
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
template<typename object_t>
xtd::unique_ptr_object< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
template<typename object_a_t, typename object_b_t>
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
template<typename object_a_t, typename object_b_t>
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.

Member Typedef Documentation

◆ exception_ref

Optional reference wrapper on std::exception.

Constructor & Destructor Documentation

◆ exception() [1/3]

xtd::exception::exception ( const xtd::diagnostics::stack_frame & stack_frame = xtd::diagnostics::stack_frame::current())
explicit

Create a new instance of class exception.

Parameters
stack_frame(optional) Contains current stack frame about member name, file path and line number in the file where the exception is occurred. Typically xtd::diagnostics::stack_frame::current().
Remarks
Message is set with the default message associate to the exception.

◆ exception() [2/3]

xtd::exception::exception ( const xtd::optional< xtd::string > & message,
const xtd::diagnostics::stack_frame & stack_frame = xtd::diagnostics::stack_frame::current() )
explicit

Create a new instance of class exception.

Parameters
messageMessage string associate to the exception.
stack_frame(optional) Contains current stack frame about member name, file path and line number in the file where the exception is occurred. Typically xtd::diagnostics::stack_frame::current().

◆ exception() [3/3]

template<typename exception_t>
xtd::exception::exception ( const xtd::optional< xtd::string > & message,
const exception_t & inner_exception,
const xtd::diagnostics::stack_frame & stack_frame = xtd::diagnostics::stack_frame::current() )
inline

Create a new instance of class exception.

Parameters
messageMessage string associate to the exception.
inner_exceptionThe exception that is the cause of the current exception.
stack_frame(optional) Contains current stack frame about member name, file path and line number in the file where the exception is occurred. Typically xtd::diagnostics::stack_frame::current().

Member Function Documentation

◆ help_link() [1/2]

virtual auto xtd::exception::help_link ( ) const -> const xtd::string &
nodiscardvirtualnoexcept

Gets a link to the help file associated with this exception.

Returns
A string represent a link to Help file associated with exception

◆ help_link() [2/2]

virtual auto xtd::exception::help_link ( const xtd::string & value) -> void
virtualnoexcept

Sets a link to the help file associated with this exception.

Parameters
valueA string represent a link to Help file associated with exception

◆ h_result() [1/2]

virtual auto xtd::exception::h_result ( ) const -> xtd::int32
nodiscardvirtualnoexcept

Gets HRESULT, a coded numerical value that is assigned to a specific exception.

Returns
The HRESULT value.

◆ h_result() [2/2]

virtual auto xtd::exception::h_result ( xtd::int32 value) -> void
virtualnoexcept

Sets HRESULT, a coded numerical value that is assigned to a specific exception.

Parameters
valueThe HRESULT value.

◆ error_code() [1/2]

virtual auto xtd::exception::error_code ( ) const -> const std::error_code &
nodiscardvirtualnoexcept

Gets error associate to the exception.

Returns
An error_code represent a Error associate to the exception

◆ error_code() [2/2]

virtual auto xtd::exception::error_code ( const std::error_code & value) -> void
virtualnoexcept

Sets error associate to the exception.

Parameters
valueAn error_code represent a Error associate to the exception

◆ inner_exception()

virtual auto xtd::exception::inner_exception ( ) const -> exception_ref
nodiscardvirtualnoexcept

Gets the exception instance that caused the current exception.

Returns
An instance of exception that describes the error that caused the current exception. The inner_exception property returns the same value as was passed into the constructor, or a null reference if the inner exception value was not supplied to the constructor.

◆ message()

virtual auto xtd::exception::message ( ) const -> const xtd::string &
nodiscardvirtualnoexcept

Gets message associate to the exception.

Returns
A string represent a massage associate to the exception

Reimplemented in xtd::io::file_not_found_exception.

◆ source() [1/2]

virtual auto xtd::exception::source ( ) const -> const xtd::string &
nodiscardvirtualnoexcept

Gets the name of the application or the object that causes the error.

Returns
The name of the application or the object that causes the error.
Remarks
If the xtd::exception::source property is not set explicitly, the runtime automatically sets it to the name of the assembly in which the exception originated.

◆ source() [2/2]

virtual auto xtd::exception::source ( const xtd::string & value) -> void
virtualnoexcept

Sets the name of the application or the object that causes the error.

Returns
The name of the application or the object that causes the error.
Remarks
If the xtd::exception::source property is not set explicitly, the runtime automatically sets it to the name of the assembly in which the exception originated.

◆ stack_trace()

virtual auto xtd::exception::stack_trace ( ) const -> xtd::string
nodiscardvirtualnoexcept

Gets a string representation of the immediate frames on the call stack.

Returns
A string that describes the immediate frames of the call stack.

◆ get_last_stack_frame()

virtual auto xtd::exception::get_last_stack_frame ( ) const -> const xtd::diagnostics::stack_frame &
nodiscardvirtualnoexcept

Gets the last stack frame where the exception occurred.

Returns
The last stack frame where exception occurred

◆ to_string()

auto xtd::exception::to_string ( ) const -> xtd::string
nodiscardoverridevirtualnoexcept

Returns a string that represents the current exception.

Returns
A string that represents the current exception.

Reimplemented from xtd::object.

◆ what()

auto xtd::exception::what ( ) const -> const char *override
nodiscardoverridenoexcept

Gets message associate to the exception.

Returns
A string represent a massage associate to the exception

◆ enable_stack_trace() [1/2]

auto xtd::exception::enable_stack_trace ( ) -> bool
staticnodiscardnoexcept

Gets if the generation of the stack trace is enabled.

Returns
triue if stack trace enabled; otherwise false.

◆ enable_stack_trace() [2/2]

auto xtd::exception::enable_stack_trace ( bool enable) -> void
staticnoexcept

Sets if the generation of the stack trace is enabled. @paran enable triue if stack trace enabled; otherwise false.


The documentation for this class was generated from the following file: