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

Allow to simply pass a status code as error #10

Closed
wants to merge 1 commit into from

Conversation

piranna
Copy link

@piranna piranna commented Dec 8, 2015

Instead of a full error object with a status or statusCode entry, allow to pass just the number of the status code.

Instead of a full error object with a `status` or `statusCode` entry, allow to pass just the number of the status code.
@dougwilson
Copy link
Contributor

Hi! Thanks for the suggestion, buy it won't be accepted, I'm sorry. The interface to this module expects to be called exactly as Node.js style callbacks, where the first argument is an error object. If you are looking for a quick way to covert a number into an error object with the properties, look into modules like "http-errors" on npm :)

@piranna
Copy link
Author

piranna commented Dec 8, 2015

I think this is simpler for casual users, just call the callback with the error code and you are done, and it doesn't break the current "good style" API, but I think this last one could be more focused when you want to send more info like the stack or a custom message... I'll look about the module you've talk me about though, but I think this suggestion could still have a valid use case :-)

@dougwilson
Copy link
Contributor

Hi! Unfortunately it is not a valid use case to us, I'm sorry. You're welcome to fork this module and offer a competing implementation if you desire.

@pillarjs pillarjs locked and limited conversation to collaborators Dec 8, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants