dgram: convert to using internal/errors

Covert lib/dgram.js over to using lib/internal/errors.js
for generating Errors. See
[using-internal-errors.md](https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md)
for more details.

I have not addressed the cases that use errnoException() and
exceptionWithHostPort() helper methods as changing these would require
fixing the tests across all of the different files that use them. In
addition, these helpers already add a `code` to the Error and we'll
have to discuss how that interacts with the `code` used by
lib/internal/errors.js.  I believe we should convert all users
of errnoException and exceptionWithHostPort in a PR dedicated to
that conversion.

PR-URL: https://github.com/nodejs/node/pull/12926
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben.bridgewater@fintura.de>
This commit is contained in:
Michael Dawson authored and Michael Dawson committed 2017-05-24 10:16:46 -04:00
1 parent 1aad4ba284
commit e912c67d24
11 files changed
+167 -47

No files matched your search

+29
View File
@@ -703,6 +703,35 @@ in some cases may accept `func(undefined)` but not `func()`). In most native
Node.js APIs, `func(undefined)` and `func()` are treated identically, and the
[`ERR_INVALID_ARG_TYPE`][] error code may be used instead.
<a id="ERR_SOCKET_ALREADY_BOUND"></a>
### ERR_SOCKET_ALREADY_BOUND
An error using the `'ERR_SOCKET_ALREADY_BOUND'` code is thrown when an attempt
is made to bind a socket that has already been bound.
<a id="ERR_SOCKET_BAD_PORT"></a>
### ERR_SOCKET_BAD_PORT
An error using the `'ERR_SOCKET_BAD_PORT'` code is thrown when an API
function expecting a port > 0 and < 65536 receives an invalid value.
<a id="ERR_SOCKET_BAD_TYPE"></a>
### ERR_SOCKET_BAD_TYPE
An error using the `'ERR_SOCKET_BAD_TYPE'` code is thrown when an API
function expecting a socket type (`udp4` or `udp6`) receives an invalid value.
<a id="ERR_SOCKET_CANNOT_SEND"></a>
### ERR_SOCKET_CANNOT_SEND
An error using the `'ERR_SOCKET_CANNOT_SEND'` code is thrown when data
cannot be sent on a socket.
<a id="ERR_SOCKET_DGRAM_NOT_RUNNING"></a>
### ERR_SOCKET_DGRAM_NOT_RUNNING
An error using the `'ERR_SOCKET_DGRAM_NOT_RUNNING'` code is thrown
when a call is made and the UDP subsystem is not running.
<a id="ERR_STDERR_CLOSE"></a>
### ERR_STDERR_CLOSE