Skip to content

dgram: better error messages#250

Closed
evanlucas wants to merge 4 commits intonodejs:v1.xfrom
evanlucas:dgram-better-error-messages
Closed

dgram: better error messages#250
evanlucas wants to merge 4 commits intonodejs:v1.xfrom
evanlucas:dgram-better-error-messages

Conversation

@evanlucas
Copy link
Copy Markdown
Contributor

This PR adds address and port properties to dgram error messages for better reporting.

Evan Lucas added 3 commits January 7, 2015 18:07
This will allow util._detailedException to be used in both net and
dgram for better error messages.
Add address and port to errors where applicable for better reporting
@rvagg
Copy link
Copy Markdown
Member

rvagg commented Jan 8, 2015

very nice, will leave it to someone more expert on this module to "lgtm" this though

Comment thread lib/util.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this name is too generic, createDetailedBindException, or exceptionWithHostPort would be better. Other libraries, like fs, might also need detailed exceptions, but with different properties.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. I would think the exceptionWithHostPort would be more descriptive. I'll go ahead and change it to that if that works.

@sam-github
Copy link
Copy Markdown
Contributor

I like it, net and dgram should have same detail in exceptions.

@ilanbiala
Copy link
Copy Markdown

@evanlucas can you give a before and after of the error message?

@evanlucas
Copy link
Copy Markdown
Contributor Author

Before: Error: send EADDRNOTAVAIL

After: Error: send EADDRNOTAVAIL 255.255.255.255:12646

@ilanbiala
Copy link
Copy Markdown

That's better already, but it would be nice if when printed it reads Address/port not available instead of the error code used for switch/if statements. This would make it much more user-friendly and still keep the code simple.

@piscisaureus
Copy link
Copy Markdown
Contributor

lgtm, a marked improvement. I'll land after running the tests.

piscisaureus pushed a commit that referenced this pull request Jan 8, 2015
This allows _detailedException() to be used by both the 'net' and
'dgram' modules to provide more informative error messages.

PR-URL: #250
Reviewed-By: Bert Belder <[email protected]>
piscisaureus pushed a commit that referenced this pull request Jan 8, 2015
The _detailedException() helper function used to be local to the 'net'
module, but now that it has been moved to 'util' a more descriptive name
is desirable.

PR-URL: #250
Reviewed-By: Bert Belder <[email protected]>
piscisaureus pushed a commit that referenced this pull request Jan 8, 2015
@piscisaureus
Copy link
Copy Markdown
Contributor

Thanks, landed in 8a0e7d6...c9fd9e2

jasnell added a commit to jasnell/node-joyent that referenced this pull request Mar 5, 2015
Port of the io.js util._exceptionWithHostPort addition.
Slight change to omit the ex.address and ex.port from the generated
error to avoid the API change. These are commented out for now so
they can be added back in easily later. Pulled over the changes made
to dgram and net to use this. Added an additional
test-net-server-errmsg
test as additional verification

see: nodejs/node#250 for reference.

Addresses: nodejs#9294

/cc @joyent/node-coreteam
jasnell added a commit to jasnell/node-joyent that referenced this pull request Mar 5, 2015
Port of the io.js util._exceptionWithHostPort addition.
Slight change to omit the ex.address and ex.port from the generated
error to avoid the API change. These are commented out for now so
they can be added back in easily later. Pulled over the changes made
to dgram and net to use this. Added an additional
test-net-server-errmsg
test as additional verification

see: nodejs/node#250 for reference.

Addresses: nodejs#9294

/cc @joyent/node-coreteam
jasnell added a commit to jasnell/node-joyent that referenced this pull request Mar 5, 2015
Port of the io.js util._exceptionWithHostPort addition.
Slight change to omit the ex.address and ex.port from the generated
error to avoid the API change. These are commented out for now so
they can be added back in easily later. Pulled over the changes made
to dgram and net to use this. Added an additional
test-net-server-errmsg
test as additional verification

see: nodejs/node#250 for reference.

Addresses: nodejs#9294

/cc @joyent/node-coreteam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants