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

Feature: Set specific status separately from the code. #3

Closed
tracker1 opened this issue Jun 10, 2014 · 4 comments
Closed

Feature: Set specific status separately from the code. #3

tracker1 opened this issue Jun 10, 2014 · 4 comments

Comments

@tracker1
Copy link

example:

errors.create({ name:'MyHttpRequestError', status: 400, ... });
errors.MyHttpRequestError()

outputs:

{
  "name": "MyHttpRequestError",
  "code": 601,
  "status": 400,
  ...
}
@bodenr
Copy link
Owner

bodenr commented Jun 17, 2014

@tracker1 i will try to get to this in the next few days or worst case this weekend.

bodenr added a commit that referenced this issue Jun 20, 2014
bodenr added a commit that referenced this issue Jun 20, 2014
@bodenr
Copy link
Owner

bodenr commented Jun 20, 2014

@tracker1 this support is committed to master. If you could please pull master and give it a spin + provide feedback that would be great.

Example:

errors.create({name: 'CustomHttpError', status: 488});
console.log(new errors.CustomHttpError().toJSON());

outputs

  ...
  code: 610,
  status: 488,
  name: 'CustomHttpError',
  message: 'An unexpected CustomHttpError occurred.' }

You can also override on the constructor.. e.g.

new errors.MyException({status: 488});

@bodenr
Copy link
Owner

bodenr commented Jun 23, 2014

published to npm as 0.2.0... closing

@bodenr bodenr closed this as completed Jun 23, 2014
@tracker1
Copy link
Author

Nice, thanks... :-)

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

No branches or pull requests

2 participants