diff mbox series

[v2,2/3] api docs: document BUG() in api-error-handling.txt

Message ID patch-2.3-ce78c79c9ac-20210413T090603Z-avarab@gmail.com (mailing list archive)
State Accepted
Commit 4bf0c6f38f8a3dda532ab7e4b9b32d6c4bb925ec
Headers show
Series trace2 docs: note that BUG() sends an "error" event | expand

Commit Message

Ævar Arnfjörð Bjarmason April 13, 2021, 9:08 a.m. UTC
When the BUG() function was added in d8193743e08 (usage.c: add BUG()
function, 2017-05-12) these docs added in 1f23cfe0ef5 (doc: document
error handling functions and conventions, 2014-12-03) were not
updated. Let's do that.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Documentation/technical/api-error-handling.txt | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Jeff King April 15, 2021, 10 a.m. UTC | #1
On Tue, Apr 13, 2021 at 11:08:20AM +0200, Ævar Arnfjörð Bjarmason wrote:

> When the BUG() function was added in d8193743e08 (usage.c: add BUG()
> function, 2017-05-12) these docs added in 1f23cfe0ef5 (doc: document
> error handling functions and conventions, 2014-12-03) were not
> updated. Let's do that.

Wow, I had no idea this file even existed (most of the time I looked at
technical/api-* the contents were along the lines of "somebody should
write this").

IMHO this is more evidence that this stuff should just go into header
files, where people are more likely to see and update it.

> diff --git a/Documentation/technical/api-error-handling.txt b/Documentation/technical/api-error-handling.txt
> index ceeedd485c9..71486abb2f0 100644
> --- a/Documentation/technical/api-error-handling.txt
> +++ b/Documentation/technical/api-error-handling.txt
> @@ -1,8 +1,11 @@
>  Error reporting in git
>  ======================
>  
> -`die`, `usage`, `error`, and `warning` report errors of various
> -kinds.
> +`BUG`, `die`, `usage`, `error`, and `warning` report errors of
> +various kinds.
> +
> +- `BUG` is for failed internal assertions that should never happen,
> +  i.e. a bug in git itself.

Your change looks obviously correct, of course.

-Peff
diff mbox series

Patch

diff --git a/Documentation/technical/api-error-handling.txt b/Documentation/technical/api-error-handling.txt
index ceeedd485c9..71486abb2f0 100644
--- a/Documentation/technical/api-error-handling.txt
+++ b/Documentation/technical/api-error-handling.txt
@@ -1,8 +1,11 @@ 
 Error reporting in git
 ======================
 
-`die`, `usage`, `error`, and `warning` report errors of various
-kinds.
+`BUG`, `die`, `usage`, `error`, and `warning` report errors of
+various kinds.
+
+- `BUG` is for failed internal assertions that should never happen,
+  i.e. a bug in git itself.
 
 - `die` is for fatal application errors.  It prints a message to
   the user and exits with status 128.