|
| | ErrorModal (std::string_view message, DismissedCallbackT &&dismissed_callback) |
| | Raise the modal given a simple unformatted message.
|
| | ErrorModal (std::string_view new_prefix, const std::runtime_error &exception, DismissedCallbackT &&dismissed_callback) |
| | Raise the modal given a prefix and a detailed exception.
|
| void | draw () noexcept override |
| | Draw the panel to the active rendering context.
|
| const char * | get_imgui_name () const noexcept override |
| | Retrieves the name of the IPanel for Dear ImGui API functions.
|
| virtual void | update_gpu (const wgpu::CommandEncoder &command_encoder) |
| | Delegate work to the GPU via the WebGPU platform.
|
Provides a persistent ImGui state to raise errors as a modal.
Error modals provide a message, an optional detail string derived from an exception, and a single button to dismiss the modal.
Definition at line 26 of file ErrorModal.hpp.
Raise the modal given a prefix and a detailed exception.
- Parameters
-
| new_prefix | An unformatted string literal to display as the major text. |
| exception | An exception containing a message to display as the minor text. |
| dismissed_callback | Callback to invoke when the ErrorModal is cancelled. |
Since this routine will often be called from exception handlers, it provides a no-exception guarantee (to prevent program termination). If a low-level system call fails, such as memory allocation to copy the error text, the exception is caught and logged with the system logger; the modal is not raised.
Definition at line 32 of file ErrorModal.cpp.
36 :
37 panel_name(std::string("Error!") + get_imgui_stable_name()),
38 dismissed_callback(std::move(dismissed_callback))
39{
40 try {
41 detail = exception.
what();
42 prefix = new_prefix;
43 } catch (const std::exception&) {
44 LOG_ERROR(
"Could not allocate memory to display modal on UI.");
45 return;
46 }
47}