Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent error messages in all modules #1220

Closed
micnic opened this issue Mar 20, 2015 · 11 comments
Closed

Consistent error messages in all modules #1220

micnic opened this issue Mar 20, 2015 · 11 comments
Labels
discuss Issues opened for discussions and feedbacks.

Comments

@micnic
Copy link
Contributor

micnic commented Mar 20, 2015

Based on PR #892 I want to propose to define some general rules for writing error messages. For the beginning, I propose the following rules:

  • Capitalized first word at the beginning of the message

TypeError: First argument should be a string or buffer

  • Quoted variable name

Error: "name" argument is required

  • Verbose message text

Error: Bad argument // instead of "bad arg" which is used now in SyncWriteStream.prototype.write
RangeError: "n" should be less than or equal to "kMaxLength"

cc @iojs/collaborators

@micnic micnic added the discuss Issues opened for discussions and feedbacks. label Mar 20, 2015
@tellnes
Copy link
Contributor

tellnes commented Mar 20, 2015

+1

1 similar comment
@mscdex
Copy link
Contributor

mscdex commented Mar 20, 2015

+1

@Fishrock123
Copy link
Contributor

What about ending periods?

I kinda prefer backticks to quotations for code references, but that's probably just because of markdown.

@micnic
Copy link
Contributor Author

micnic commented Mar 20, 2015

@Fishrock123, I think periods are irrelevant in understanding the message of the error

another thing that I missed: error message length limit ~60 chars

@mscdex
Copy link
Contributor

mscdex commented Mar 20, 2015

@micnic How would that work for error messages that contain dynamic content, such as filenames?

@micnic
Copy link
Contributor Author

micnic commented Mar 20, 2015

@mscdex, for error messages with some urls or filenames attached it will not work :) but at least we should take in count this while using some messages like the following ones:

'"localAddress" argument must be a valid IP: ' + localAddress
'"port" argument should be > 0 and < 65536: ' + port
'Parameter "pathObject" must be an object, not ' + typeof pathObject

@silverwind
Copy link
Contributor

+1

Do we have a file where we write down rules such as this? CONTRIBUTING.md doesn't seem to contain anything in regards to code style (and error style). Maybe we should add a STYLE.md or an section to CONTRIBUTING.md.

cc: @mikeal

@chrisdickinson
Copy link
Contributor

We don't really have a great place at present to record these sorts of decisions. It would be cool to start a doc/internal directory for internal development guidelines & documentation, though.

@brendanashworth
Copy link
Contributor

We definitely need something like that. +1

@yosuke-furukawa
Copy link
Member

+1 !

@cjihrig
Copy link
Contributor

cjihrig commented Nov 10, 2015

Closing as this landed in 20285ad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss Issues opened for discussions and feedbacks.
Projects
None yet
Development

No branches or pull requests

9 participants