Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Nov 15, 2021
1 parent 298ae67 commit 8c38486
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@

* Drop support for Node.js 0.6
* Remove `I'mateapot` export; use `ImATeapot` instead
* Rename `UnorderedCollection` constructor to `TooEarly`
* deps: [email protected]
- Replace internal `eval` usage with `Function` constructor
- Use instance methods on `process` to check for listeners
* deps: [email protected]
- Fix messaging casing of `418 I'm a Teapot`
- Remove code 306
- Rename `425 Unordered Collection` to standard `425 Too Early`

2021-11-14 / 1.8.1
==================
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ var err = new createError.NotFound()
|422 |UnprocessableEntity |
|423 |Locked |
|424 |FailedDependency |
|425 |UnorderedCollection |
|425 |TooEarly |
|426 |UpgradeRequired |
|428 |PreconditionRequired |
|429 |TooManyRequests |
Expand Down
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function createError () {
}

if (typeof status !== 'number' ||
(!statuses[status] && (status < 400 || status >= 600))) {
(!statuses.message[status] && (status < 400 || status >= 600))) {
status = 500
}

Expand All @@ -91,7 +91,7 @@ function createError () {
// create error
err = HttpError
? new HttpError(msg)
: new Error(msg || statuses[status])
: new Error(msg || statuses.message[status])
Error.captureStackTrace(err, createError)
}

Expand Down Expand Up @@ -135,7 +135,7 @@ function createClientErrorConstructor (HttpError, name, code) {

function ClientError (message) {
// create the error object
var msg = message != null ? message : statuses[code]
var msg = message != null ? message : statuses.message[code]
var err = new Error(msg)

// capture a stack trace to the construction point
Expand Down Expand Up @@ -204,7 +204,7 @@ function createServerErrorConstructor (HttpError, name, code) {

function ServerError (message) {
// create the error object
var msg = message != null ? message : statuses[code]
var msg = message != null ? message : statuses.message[code]
var err = new Error(msg)

// capture a stack trace to the construction point
Expand Down Expand Up @@ -264,7 +264,7 @@ function nameFunc (func, name) {
function populateConstructorExports (exports, codes, HttpError) {
codes.forEach(function forEachCode (code) {
var CodeError
var name = toIdentifier(statuses[code])
var name = toIdentifier(statuses.message[code])

switch (codeClass(code)) {
case 400:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"depd": "2.0.0",
"inherits": "2.0.4",
"setprototypeof": "1.2.0",
"statuses": ">= 1.5.0 < 2",
"statuses": "2.0.1",
"toidentifier": "1.0.1"
},
"devDependencies": {
Expand Down

0 comments on commit 8c38486

Please sign in to comment.