http-errors
http-errors copied to clipboard
Create HTTP Errors
After updating NPM packages, this exception started happening on each request. ``` TypeError: Cannot read properties of undefined (reading 'split') at toIdentifier (D:\home\site\wwwroot\node_modules\send\node_modules\toidentifier\index.js:24:6) at forEachCode (D:\home\site\wwwroot\node_modules\send\node_modules\http-errors\index.js:245:16) at Array.forEach () at...
[String.prototype.substr()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) is deprecated so we replace it with [String.prototype.slice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) which works similarily but isn't deprecated. .substr() probably isn't going away anytime soon but the change is trivial so it doesn't...
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...
You would expect these usages to log identically: ```js import createError from 'http-errors' console.log( JSON.stringify(createError('Message 1.')), JSON.stringify(createError(new Error('Message 2.'))) ) ``` They actually output this: ``` {"message":"Message 1."} {"expose":false,"statusCode":500,"status":500} ```...
The createError factory is already fairly versatile. It accepts Error objects and assimilates their name/status/stack. It accepts numbers and strings (taking the appropriate status). And it also accepts objects, assimilating...
Based on #103 Users likely expect to be able to pass custom properties to errors when creating them via the shortcut methods such as `createError.NotFound()`. Proposed change would look something...
closes #98 ## The Issue Currently subclasses of error classes like NotFound do not correctly set up the prototype chain, leading to unexpected behavior with instanceof checks. Also, extending HttpError...
# Main Changes This pipeline will proactively report the status of the project (every day and when a push is done to `master` branch) including critical fields (`CI-Tests`, `Contributors`, `Dependency-Update-Tool`,...
Seems like the current `master` branch have some broken tests when running Node@8 and Node@9. I realized that with the PR: https://github.com/jshttp/http-errors/pull/107. Similar error in both cases: https://github.com/jshttp/http-errors/actions/runs/8278069455/job/22650768076#step:10:104, here is...
I would expect ``` httpError(500, httpError(402)).statusCode ``` to be 500, but it's 402. (The use case here is that I have a `try`/`catch` statement that turns all exceptions into HTTP...