Errors: forgotten, but not gone
summary
Built a virtual smart card emulator on Windows and discovers errors are a lifetime issue, so implement a RAII-style unique_error that treats an error like a resource: if it is destroyed without being checked it aborts, if checked it can be reset or released to the caller. Provides traits to define initialization and "ok", plus helpers that turn common Windows BOOL+GetLastError patterns into a unique_error; code is on GitHub and the approach catches forgotten checks at runtime.
AI-written summary · about
chapters (5)
- 0:00Start
- 0:45Is it a runtime error?
- 1:01Is it a code bug?
- 1:35errors need to get a lifetime
- 2:55example implementation for a Win32 winerror type
related talks
53mThe Dawn Of A New Error
44mA Practical Approach to Error Handling
57m“The Unexceptional Exceptions"
45mTo Err is Human - Robust Error Handling in C++26
01h 29mC++ Error Handling
01h 02mBack to Basics: Exceptions
44mA Practical Approach to Error Handling
44mError handling in C++: as easy as "use exceptions"?
