Add section on error reporting to coding guidelines#48
Conversation
|
|
||
| To report an error and abort the current transaction, throw a `TextException("descriptive text", Here())`. | ||
| Use `Assure(condition)` to test an invariant and abort the current transaction. | ||
| To check system-leve invariants, where a failure needs to terminate Squid, use `xassert(condition)` |
There was a problem hiding this comment.
| To check system-leve invariants, where a failure needs to terminate Squid, use `xassert(condition)` | |
| To check system-level invariants, where a failure needs to terminate Squid, use `xassert(condition)` |
|
There is also It would be useful to mention what "report" means: where, how, and what does it look like for each of these cases? Also, IIRC Alex had a definition of "invariant" that did not quite line up with C/C++ standard definition of the terminology. I came away from the |
rousskov
left a comment
There was a problem hiding this comment.
I welcome this attempt at documenting error handling and invariant checking guidelines. Related code is often problematic, and documentation can help reduce the number of problems and correction overheads.
There is at least one bug and several problematic statements in the current version. It is also very difficult to derive the correct decision making algorithm from the proposed sentences. As Amos has noted, it is probably best to cover static_assert cases here as well.
I will find the time to rewrite this. I do not recommend making changes until then.
It's more than this. Coding Guidelines can (and should) feed LLMs, both code-writing and code-reviewing ones.
Feel free to improve |
No description provided.