1
0
mirror of https://github.com/ocornut/imgui.git synced 2025-02-25 14:34:40 +01:00

Updated Error Handling (markdown)

omar 2024-09-30 11:54:33 +02:00
parent 15641b9936
commit 7213c769e0

@ -6,6 +6,7 @@ Since Dear ImGui 1.91.3 we provide way to configure how to handle _SOME_ recover
- Error recovery is provided as a way to facilitate recovery from errors in e.g. scripting languages, or after specific exceptions handlers.
- Error recovery is not perfect nor guaranteed! You are not supposed to rely on it in the course of a normal application run.
- By design, we do NOT allow error recovery to be 100% silent. One of the three options needs to be checked.
- Always ensure that on programmers seat you have at minimum Asserts or Tooltips enabled when making direct imgui API call! Otherwise it would severely hinder your ability to catch and correct mistakes!
Typical scenarios:
@ -19,7 +20,7 @@ Typical scenarios:
- Disable Asserts `io.ConfigErrorRecoveryEnableAssert=false` but keep Tooltips visible.
- Recoverable errors will be visible in an error tooltip.
- The error tooltip will allow user to enable asserts.
- THIS IMPLICITLY RELY ON RECOVERY BEING FUNCTIONAL. A FEW CASES MIGHT PROBABLY STILL CRASH/ASSERTS.
- This implicitly rely on functional recovery. A few cases might probably still crash/assert. If this works well, we may make it the default in future versions.
#### (3) Non-programmer seats: what you might want to setup:
- Use `io.ConfigErrorRecoveryEnableAssert=false`, but make sure log entries are well visible or reported somewhere.
@ -63,9 +64,17 @@ bool ConfigErrorRecoveryEnableTooltip; // = true // Enable toolti
e.g.
```cpp
ImGuiErrorRecoveryState state;
ImGui::ErrorRecoveryStoreState(&state);
.... run scripting code
ImGui::ErrorRecoveryTryToRecoverState(&state);
```
Exception handling:
```cpp
ImGuiErrorRecoveryState state;
ImGui::ErrorRecoveryStoreState(&state);
try
{
ImGui::ErrorRecoveryStoreState(&state);
.... run code
}
catch