8 #include <system_error>
27 using exception_ref = std::optional<std::reference_wrapper<const std::exception>>;
98 static void enable_stack_trace(
bool enable) {enable_stack_trace_ = enable;}
102 virtual std::error_code
error_code() const noexcept {
return error_;}
110 virtual uint32_t
line_number() const noexcept {
return information_.get_file_line_number();}
133 friend std::ostream& operator<<(std::ostream& os, const
xtd::
system_exception& e) noexcept {
134 return os <<
e.to_string();
140 const char*
what() const noexcept
override {
return message().empty() ? name().c_str() : message().c_str();}
145 const
char* default_message() const;
147 static
bool enable_stack_trace_;
150 exception_ref inner_exception_;
151 std::error_code error_;
153 xtd::diagnostics::stack_frame information_;
154 std::shared_ptr<
xtd::diagnostics::stack_trace> stack_trace_;
170 #define system_exception_(...) system_exception(add_current_stack_frame_(__VA_ARGS__))
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition: stack_frame.h:29
static stack_frame empty() noexcept
Return an empty stack frame.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition: object.h:26
Defines the base class for predefined exceptions in the xtd namespace.
Definition: system_exception.h:24
system_exception(const xtd::ustring &message, const std::exception &inner_exception, const std::error_code &error, const xtd::ustring &help_link, const xtd::diagnostics::stack_frame &information=xtd::diagnostics::stack_frame::empty())
Create a new instance of class system_exception.
Definition: system_exception.h:81
system_exception(const xtd::diagnostics::stack_frame &information=xtd::diagnostics::stack_frame::empty())
Create a new instance of class system_exception.
Definition: system_exception.h:32
virtual const xtd::ustring & help_link() const noexcept
Gets a link to the help file associated with this exception.
Definition: system_exception.h:94
virtual const xtd::ustring & file_path() const noexcept
Get file path where exception occurred.
Definition: system_exception.h:90
static bool enable_stack_trace()
Gets or sets if the generation of the stack trace is enabled.
Definition: system_exception.h:97
virtual const xtd::ustring & member_name() const noexcept
Get file member where exception occurred.
Definition: system_exception.h:114
virtual uint32_t line_number() const noexcept
Get Line number where the exception occurred.
Definition: system_exception.h:110
system_exception(const xtd::ustring &message, const std::error_code &error, const xtd::ustring &help_link, const xtd::diagnostics::stack_frame &information=xtd::diagnostics::stack_frame::empty())
Create a new instance of class system_exception.
Definition: system_exception.h:52
system_exception(const xtd::ustring &message, const xtd::ustring &help_link, const xtd::diagnostics::stack_frame &information=xtd::diagnostics::stack_frame::empty())
Create a new instance of class system_exception.
Definition: system_exception.h:46
system_exception(const xtd::ustring &message, const std::exception &inner_exception, const xtd::ustring &help_link, const xtd::diagnostics::stack_frame &information=xtd::diagnostics::stack_frame::empty())
Create a new instance of class system_exception.
Definition: system_exception.h:74
virtual xtd::ustring stack_trace() const noexcept
Gets a string representation of the immediate frames on the call stack.
Definition: system_exception.h:126
std::optional< std::reference_wrapper< const std::exception > > exception_ref
Optional reference wrapper on std::exception.
Definition: system_exception.h:27
system_exception(const xtd::ustring &message, const xtd::diagnostics::stack_frame &information=xtd::diagnostics::stack_frame::empty())
Create a new instance of class system_exception.
Definition: system_exception.h:36
system_exception(const xtd::ustring &message, const std::exception &inner_exception, const std::error_code &error, const xtd::diagnostics::stack_frame &information=xtd::diagnostics::stack_frame::empty())
Create a new instance of class system_exception.
Definition: system_exception.h:68
system_exception(const std::exception &inner_exception, const xtd::diagnostics::stack_frame &information=xtd::diagnostics::stack_frame::empty())
Create a new instance of class system_exception.
Definition: system_exception.h:57
xtd::ustring to_string() const noexcept override
Returns a string that represents the current exception.
virtual const xtd::ustring & name() const noexcept
Get full class name the exception.
Definition: system_exception.h:122
const char * what() const noexcept override
Get message associate to the exception.
Definition: system_exception.h:140
system_exception(const xtd::ustring &message, const std::exception &inner_exception, const xtd::diagnostics::stack_frame &information=xtd::diagnostics::stack_frame::empty())
Create a new instance of class system_exception.
Definition: system_exception.h:62
virtual std::error_code error_code() const noexcept
Get error associate to the exception.
Definition: system_exception.h:102
system_exception(const xtd::ustring &message, const std::error_code &error, const xtd::diagnostics::stack_frame &information=xtd::diagnostics::stack_frame::empty())
Create a new instance of class system_exception.
Definition: system_exception.h:41
virtual const xtd::ustring & message() const noexcept
Get message associate to the exception.
Definition: system_exception.h:118
virtual exception_ref inner_exception() const noexcept
Gets the exception instance that caused the current exception.
Definition: system_exception.h:106
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
static ustring full_class_name()
Gets the fully qualified class name of the objec_t, including the namespace of the objec_t.
Definition: ustring.h:427
Contains core_export_ keyword.
#define core_export_
Define shared library export.
Definition: core_export.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::object class.
Contains xtd::diagnostics::stack_frame class.
Contains xtd::diagnostics::stack_trace class.
Contains xtd::ustring class.