Skip to content

Commit

Permalink
style: formalize exception policy on the data path. (envoyproxy#4793)
Browse files Browse the repository at this point in the history
Signed-off-by: Harvey Tuch <[email protected]>
  • Loading branch information
htuch authored and mattklein123 committed Oct 22, 2018
1 parent a890b2c commit 7f4c6ff
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@

* Exceptions are allowed and encouraged where appropriate. When using exceptions, do not add
additional error handing that cannot possibly happen in the case an exception is thrown.
* Do use exceptions for:
- Configuration ingestion error handling. Invalid configurations (dynamic and
static) should throw meaningful `EnvoyException`s, the configuration
ingestion code will catch these.
- Constructor failure.
- Error handling in deep call stacks, where exceptions provide material
improvements to code complexity and readability.
* Apply caution when using exceptions on the data path for general purpose error
handling. Exceptions are not caught on the data path and they should not be
used for simple error handling, e.g. with shallow call stacks, where explicit
error handling provides a more readable and easier to reason about
implementation.
* References are always preferred over pointers when the reference cannot be null. This
includes both const and non-const references.
* Function names should all use camel case starting with a lower case letter (e.g., `doFoo()`).
Expand Down

0 comments on commit 7f4c6ff

Please sign in to comment.