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

Add "expose" to "new createError.[code || name]([msg]))" syntax #78

Open
maneetgoyal opened this issue May 21, 2021 · 1 comment
Open

Comments

@maneetgoyal
Copy link

Hi all,

Please consider add support for expose property in new createError.[code || name]([msg])) like syntax.

We use new createError.name([msg])) a lot because of its readability. It also mitigates the need to remember all those status codes. Being able to do something like below will be of great help.

var err = new createError.NotFound("Show this error to client.", {expose: true, ...});
@dougwilson
Copy link
Contributor

Thanks for the suggestion @maneetgoyal . This will be included in the upcoming 3.0 release as it provides an update to align to the new options feature of the global Error constructor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants