Updated Error Handling (markdown)

omar
2024-09-30 12:06:30 +02:00
parent 4b1a4a614d
commit f5c2804ee4

@@ -4,12 +4,12 @@ Since Dear ImGui 1.91.3 we provide way to configure how to handle _SOME_ recover
![image](https://github.com/user-attachments/assets/2c46c666-3d85-4355-b80a-730c7b748d9d)
- Error recovery is provided as a way to facilitate recovery:
- After a programming error (native code or scripting language - the later tends to facilitate iterating on code while running).
- After running an exception handler or any error processing which may skip code after an error has been detected.
- 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!
- Error recovery is provided as a way to facilitate:
- Recovery after a programming error (native code or scripting language - the later tends to facilitate iterating on code while running).
- Recovery after running an exception handler or any error processing which may skip code after an error has been detected.
- Error recovery is not perfect nor guaranteed! It is a feature to ease development. 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 seats 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:
@@ -42,19 +42,8 @@ Typical scenarios:
### API
In `ImGuiIO`:
```cpp
// Options to configure how we handle recoverable errors [EXPERIMENTAL]
// - Error recovery is not perfect nor guaranteed! It is a feature to ease development.
// - Functions that support error recovery are using IM_ASSERT_USER_ERROR() instead of IM_ASSERT().
// - You not are not supposed to rely on it in the course of a normal application run.
// - Possible usage: facilitate recovery from errors triggered from a scripting language or after specific exceptions handlers.
// - Always ensure that on programmers seat you have at minimum Asserts or Tooltips enabled when making direct imgui API calls!
// Otherwise it would severely hinder your ability to catch and correct mistakes!
// Read https://github.com/ocornut/imgui/wiki/Error-Handling for details about typical usage scenarios:
// - Programmer seats: keep asserts (default), or disable asserts and keep error tooltips (new and nice!)
// - Non-programmer seats: maybe disable asserts, but make sure errors are resurfaced (visible log entries, use callback etc.)
// - Recovery after error from scripting language: record stack sizes before running script, disable assert, trigger breakpoint from ErrorCallback, recover with ErrorRecoveryTryToRecoverState(), restore settings.
// - Recovery after an exception handler: record stack sizes before try {} block, disable assert, set log callback, recover with ErrorRecoveryTryToRecoverState(), restore settings.
bool ConfigErrorRecovery; // = true // Enable error recovery support. Some errors won't be detected and lead to direct crashes if recovery is disabled.
bool ConfigErrorRecoveryEnableAssert; // = true // Enable asserts on recoverable error. By default call IM_ASSERT() when returning from a failing IM_ASSERT_USER_ERROR()
bool ConfigErrorRecoveryEnableDebugLog; // = true // Enable debug log output on recoverable errors.