xtd 0.2.0
Loading...
Searching...
No Matches
__show_generic_exception_message.h
Go to the documentation of this file.
1
4#pragma once
6#if !defined(__XTD_CORE_INTERNAL__)
7#error "Do not include this file: Internal use only"
8#endif
10
11#include "../exception.h"
12#include "../target_id.h"
13#include "../string.h"
14#if __XTD_CURRENT_TARGET_ID__ == __XTD_TARGET_ID_GUI_APPLICATION__ || __XTD_CURRENT_TARGET_ID__ == __XTD_TARGET_ID_UNKNOWN__
17#endif
18#include <iostream>
19
21#if __XTD_CURRENT_TARGET_ID__ == __XTD_TARGET_ID_GUI_APPLICATION__ || __XTD_CURRENT_TARGET_ID__ == __XTD_TARGET_ID_UNKNOWN__
22inline void __show_generic_exception_message__(const std::exception& e) {xtd::forms::application::main_form().has_value() ? xtd::forms::exception_box::show(xtd::forms::application::main_form().value().get(), e, xtd::forms::application::product_name()) : xtd::forms::exception_box::show(e, xtd::forms::application::product_name());}
23inline void __show_generic_exception_message__() {xtd::forms::application::main_form().has_value() ? xtd::forms::exception_box::show(xtd::forms::application::main_form().value().get(), xtd::forms::application::product_name()) : xtd::forms::exception_box::show(xtd::forms::application::product_name());}
24#else
25inline void __show_generic_exception_message__(const std::exception& e) {std::cerr << std::endl << xtd::string::format("Unhandled exception: {}", dynamic_cast<const xtd::exception*>(&e) ? static_cast<const xtd::exception&>(e).to_string() : e.what()) << std::endl;}
26inline void __show_generic_exception_message__() { std::cerr << std::endl << xtd::string::format("Unhandled exception: Unknown exception occurred") << std::endl;}
27#endif
Defines the base class for predefined exceptions in the xtd namespace.
Definition exception.h:28
static std::optional< form_ref > main_form()
Gets the optional main form owned by the application.
static xtd::string product_name() noexcept
Gets the product name associated with this application.
static dialog_result show()
Displays a exception box. The exception box displays an unknown exception.
Contains xtd::forms::exception_box dialog.
static basic_string format(const basic_string< char > &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
@ show
Display the hot-key prefix.
std::string to_string(const value_t &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition to_string.h:41
@ e
The E key.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::forms::application class.