Repository: hapijs/hapi (language: javascript)

Issue:
`request` `closed` `error` tags
### Module version

21.3.12

### What documentation problem did you notice?

According to the documentation at https://hapi.dev/api/?v=21.3.12#-request-event, an internally generated error with tags `request` `closed` `error` indicates that "the request closed prematurely."

In my own application, I've seen tags of `request` `error` `close`, which apparently (also?) indicate that the request closed prematurely. I believe that this is logged from https://github.com/hapijs/hapi/blob/v21.3.12/lib/request.js#L720. This set of tags does not appear to be documented.

Therefore, I think that one of the following is true:

1. `request` `error` `close` is undocumented and should be added to API.md.
2. `request` `closed` `error` is a mistake, and it's actually `request` `error` `close` / `request` `close` `error` (depending on whether tag order is intended to matter).

(I _think_ it's the second, because I don't see in the source code where it can emit a tag of `closed` - but I could easily be mistaken. `request` `error` `close` is also more consistent with the documented `response` `error` `close`.) 


Discussion / hints:
Thanks for the report. This does indeed seem to be an unintended rename.

`'closed'` used to be emitted instead, as can be seen from this v16 code:
https://github.com/hapijs/hapi/blob/467e8de92576a05375815ed9d12716dccf847b51/lib/request.js#L185-L192

Given that `'close'` is now used in practice, I think the best fix will be to correct the documentation.

The ordering should probably also be updated to match, though it should not matter for processing inside hapi (but might for external tools that handle a logged line). The `request` `abort` `error` docs should also be updated with the new ordering.

Fix patch:
diff --git a/API.md b/API.md
index 40d8ffe88..d4678ef99 100755
--- a/API.md
+++ b/API.md
@@ -558,8 +558,8 @@ The internally generated events are (identified by their `tags`):
 - `pre` `error` - a pre method was executed and returned an error. Includes the execution duration, assignment key, and error.
 - `internal` `error` - an HTTP 500 error response was assigned to the request.
 - `internal` `implementation` `error` - an incorrectly implemented [lifecycle method](#lifecycle-methods).
-- `request` `abort` `error` - the request aborted.
-- `request` `closed` `error` - the request closed prematurely.
+- `request` `error` `abort` - the request aborted.
+- `request` `error` `close` - the request closed prematurely.
 - `request` `error` - the request stream emitted an error. Includes the error.
 - `request` `server` `timeout` `error` - the request took too long to process by the server. Includes the timeout configuration value and the duration.
 - `state` `error` - the request included an invalid cookie or cookies. Includes the cookies and error details.


Test patch: