From 960252f6895eaa3719569caa74956088b0b7e0d9 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 8 Jul 2020 11:18:25 -0700 Subject: [PATCH] quic: use less specific error codes Stop the madness. Only you can prevent excessive error code proliferation. --- doc/api/errors.md | 131 +++------------ doc/api/quic.md | 2 +- lib/internal/errors.js | 50 +----- lib/internal/quic/core.js | 158 ++++++++++-------- lib/internal/quic/util.js | 18 +- test/parallel/test-quic-client-server.js | 14 +- ...test-quic-errors-quicsession-openstream.js | 2 +- .../test-quic-errors-quicsocket-connect.js | 2 +- .../test-quic-errors-quicsocket-listen.js | 4 +- test/parallel/test-quic-ipv6only.js | 2 +- ...t-quic-quicsession-server-destroy-early.js | 5 +- test/parallel/test-quic-quicsocket-close.js | 3 +- test/parallel/test-quic-quicsocket.js | 7 +- 13 files changed, 138 insertions(+), 260 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index 92715e1236bb96..d7254956feebe4 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -1440,6 +1440,16 @@ type for one of its returned object properties on execution. Thrown in case a function option does not return an expected value type on execution, such as when a function is expected to return a promise. + +### `ERR_INVALID_STATE` + + +Indicates that an operation cannot be completed due to an invalid state. +For instance, an object may have already been destroyed, or may be +performing another operation. + ### `ERR_INVALID_SYNC_FORK_INPUT` @@ -1732,62 +1742,6 @@ Accessing `Object.prototype.__proto__` has been forbidden using [`Object.setPrototypeOf`][] should be used to get and set the prototype of an object. - -### `ERR_QUIC_CANNOT_SET_GROUPS` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUIC_ERROR` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUIC_TLS13_REQUIRED` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUICCLIENTSESSION_FAILED` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUICCLIENTSESSION_FAILED_SETSOCKET` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUICSESSION_DESTROYED` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUICSESSION_INVALID_DCID` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUICSESSION_UPDATEKEY` - -> Stability: 1 - Experimental - -TBD - ### `ERR_QUICSESSION_VERSION_NEGOTIATION` @@ -1795,62 +1749,6 @@ TBD TBD - -### `ERR_QUICSOCKET_DESTROYED` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUICSOCKET_INVALID_STATELESS_RESET_SECRET_LENGTH` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUICSOCKET_LISTENING` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUICSOCKET_UNBOUND` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUICSTREAM_DESTROYED` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUICSTREAM_INVALID_PUSH` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUICSTREAM_OPEN_FAILED` - -> Stability: 1 - Experimental - -TBD - - -### `ERR_QUICSTREAM_UNSUPPORTED_PUSH` - -> Stability: 1 - Experimental - -TBD - ### `ERR_REQUIRE_ESM` @@ -2482,6 +2380,15 @@ Used by the `N-API` when `Constructor.prototype` is not an object. A Node.js API was called in an unsupported manner, such as `Buffer.write(string, encoding, offset[, length])`. + +### `ERR_OPERATION_FAILED` + + +An operation failed. This is typically used to signal the general failure +of an asynchronous operation. + ### `ERR_OUTOFMEMORY`