joyent/node — pull request #2695 by AndreasMadsen (2012-02-04 10:35:16+00:00)
Title: Make errno message a part of errno exceptions

To people like me there don't use enough time with errno codes it can be difficult to remember what `EBADF` means. This add a text message to all errno exceptions, like `bad file descriptor`.

The messages are from `get_uv_errno_message`, to use this it was necessary to change the `SetError` so it set errno to a number and not `get_uv_errno_string`.

I'm hoping we later could abstract `ErrnoException` from `node.cc` to use `Errno::ErrnoException`.

It would also be nice to have binding functions return an `uv_errno` number instead of `1` or `0`. This way we won't pollute `global` scope with `errno`. Example of this:

```JavaScript
var Pipe = process.binding('pipe_wrap').Pipe;
var errnoException = process.binding('errno').errnoException;

function newErrno() {
var stream = new Pipe(true);
stream.close();

var buffer = new Buffer("test");
var errno = stream.write(buffer, 0, buffer.length);
if (errno !== 0) {
throw errnoException(errno);
}
}
```

@piscisaureus told me that you did not want any `errno` changes now, but since I had made the patch why do allow you to reconsider.