lnlink-server 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/app.js +2 -2
  2. package/dist/build-info.json +1 -1
  3. package/dist/index.js +3 -2
  4. package/dist/index.js.map +2 -2
  5. package/dist/node_modules/debug/.coveralls.yml +1 -0
  6. package/dist/node_modules/debug/.eslintrc +11 -0
  7. package/dist/node_modules/debug/.travis.yml +14 -0
  8. package/dist/node_modules/debug/CHANGELOG.md +362 -0
  9. package/dist/node_modules/debug/LICENSE +19 -0
  10. package/dist/node_modules/debug/Makefile +50 -0
  11. package/dist/node_modules/debug/README.md +312 -0
  12. package/dist/node_modules/debug/component.json +19 -0
  13. package/dist/node_modules/debug/karma.conf.js +70 -0
  14. package/dist/node_modules/debug/node.js +1 -0
  15. package/dist/node_modules/debug/package.json +49 -0
  16. package/dist/node_modules/debug/src/browser.js +185 -0
  17. package/dist/node_modules/debug/src/debug.js +202 -0
  18. package/dist/node_modules/debug/src/index.js +10 -0
  19. package/dist/node_modules/debug/src/inspector-log.js +15 -0
  20. package/dist/node_modules/debug/src/node.js +248 -0
  21. package/dist/node_modules/depd/History.md +96 -0
  22. package/dist/node_modules/depd/LICENSE +22 -0
  23. package/dist/node_modules/depd/Readme.md +280 -0
  24. package/dist/node_modules/depd/index.js +522 -0
  25. package/dist/node_modules/depd/lib/browser/index.js +77 -0
  26. package/dist/node_modules/depd/lib/compat/callsite-tostring.js +103 -0
  27. package/dist/node_modules/depd/lib/compat/event-listener-count.js +22 -0
  28. package/dist/node_modules/depd/lib/compat/index.js +79 -0
  29. package/dist/node_modules/depd/package.json +41 -0
  30. package/dist/node_modules/http-errors/HISTORY.md +132 -0
  31. package/dist/node_modules/http-errors/LICENSE +23 -0
  32. package/dist/node_modules/http-errors/README.md +135 -0
  33. package/dist/node_modules/http-errors/index.js +260 -0
  34. package/dist/node_modules/http-errors/package.json +48 -0
  35. package/dist/node_modules/inherits/LICENSE +16 -0
  36. package/dist/node_modules/inherits/README.md +42 -0
  37. package/dist/node_modules/inherits/inherits.js +7 -0
  38. package/dist/node_modules/inherits/inherits_browser.js +23 -0
  39. package/dist/node_modules/inherits/package.json +29 -0
  40. package/dist/node_modules/ms/index.js +152 -0
  41. package/dist/node_modules/ms/license.md +21 -0
  42. package/dist/node_modules/ms/package.json +37 -0
  43. package/dist/node_modules/ms/readme.md +51 -0
  44. package/dist/node_modules/setprototypeof/LICENSE +13 -0
  45. package/dist/node_modules/setprototypeof/README.md +26 -0
  46. package/dist/node_modules/setprototypeof/index.d.ts +2 -0
  47. package/dist/node_modules/setprototypeof/index.js +15 -0
  48. package/dist/node_modules/setprototypeof/package.json +25 -0
  49. package/dist/node_modules/statuses/HISTORY.md +65 -0
  50. package/dist/node_modules/statuses/LICENSE +23 -0
  51. package/dist/node_modules/statuses/README.md +127 -0
  52. package/dist/node_modules/statuses/codes.json +66 -0
  53. package/dist/node_modules/statuses/index.js +113 -0
  54. package/dist/node_modules/statuses/package.json +48 -0
  55. package/dist/package.json +1 -1
  56. package/dist/public/js/init.js +1 -1
  57. package/dist/setting.regtest.json +2 -1
  58. package/package.json +1 -1
@@ -0,0 +1,79 @@
1
+ /*!
2
+ * depd
3
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
4
+ * MIT Licensed
5
+ */
6
+
7
+ 'use strict'
8
+
9
+ /**
10
+ * Module dependencies.
11
+ * @private
12
+ */
13
+
14
+ var EventEmitter = require('events').EventEmitter
15
+
16
+ /**
17
+ * Module exports.
18
+ * @public
19
+ */
20
+
21
+ lazyProperty(module.exports, 'callSiteToString', function callSiteToString () {
22
+ var limit = Error.stackTraceLimit
23
+ var obj = {}
24
+ var prep = Error.prepareStackTrace
25
+
26
+ function prepareObjectStackTrace (obj, stack) {
27
+ return stack
28
+ }
29
+
30
+ Error.prepareStackTrace = prepareObjectStackTrace
31
+ Error.stackTraceLimit = 2
32
+
33
+ // capture the stack
34
+ Error.captureStackTrace(obj)
35
+
36
+ // slice the stack
37
+ var stack = obj.stack.slice()
38
+
39
+ Error.prepareStackTrace = prep
40
+ Error.stackTraceLimit = limit
41
+
42
+ return stack[0].toString ? toString : require('./callsite-tostring')
43
+ })
44
+
45
+ lazyProperty(module.exports, 'eventListenerCount', function eventListenerCount () {
46
+ return EventEmitter.listenerCount || require('./event-listener-count')
47
+ })
48
+
49
+ /**
50
+ * Define a lazy property.
51
+ */
52
+
53
+ function lazyProperty (obj, prop, getter) {
54
+ function get () {
55
+ var val = getter()
56
+
57
+ Object.defineProperty(obj, prop, {
58
+ configurable: true,
59
+ enumerable: true,
60
+ value: val
61
+ })
62
+
63
+ return val
64
+ }
65
+
66
+ Object.defineProperty(obj, prop, {
67
+ configurable: true,
68
+ enumerable: true,
69
+ get: get
70
+ })
71
+ }
72
+
73
+ /**
74
+ * Call toString() on the obj
75
+ */
76
+
77
+ function toString (obj) {
78
+ return obj.toString()
79
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "depd",
3
+ "description": "Deprecate all the things",
4
+ "version": "1.1.2",
5
+ "author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "deprecate",
9
+ "deprecated"
10
+ ],
11
+ "repository": "dougwilson/nodejs-depd",
12
+ "browser": "lib/browser/index.js",
13
+ "devDependencies": {
14
+ "benchmark": "2.1.4",
15
+ "beautify-benchmark": "0.2.4",
16
+ "eslint": "3.19.0",
17
+ "eslint-config-standard": "7.1.0",
18
+ "eslint-plugin-markdown": "1.0.0-beta.7",
19
+ "eslint-plugin-promise": "3.6.0",
20
+ "eslint-plugin-standard": "3.0.1",
21
+ "istanbul": "0.4.5",
22
+ "mocha": "~1.21.5"
23
+ },
24
+ "files": [
25
+ "lib/",
26
+ "History.md",
27
+ "LICENSE",
28
+ "index.js",
29
+ "Readme.md"
30
+ ],
31
+ "engines": {
32
+ "node": ">= 0.6"
33
+ },
34
+ "scripts": {
35
+ "bench": "node benchmark/index.js",
36
+ "lint": "eslint --plugin markdown --ext js,md .",
37
+ "test": "mocha --reporter spec --bail test/",
38
+ "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --no-exit test/",
39
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/"
40
+ }
41
+ }
@@ -0,0 +1,132 @@
1
+ 2018-03-29 / 1.6.3
2
+ ==================
3
+
4
+ * deps: depd@~1.1.2
5
+ - perf: remove argument reassignment
6
+ * deps: setprototypeof@1.1.0
7
+ * deps: statuses@'>= 1.3.1 < 2'
8
+
9
+ 2017-08-04 / 1.6.2
10
+ ==================
11
+
12
+ * deps: depd@1.1.1
13
+ - Remove unnecessary `Buffer` loading
14
+
15
+ 2017-02-20 / 1.6.1
16
+ ==================
17
+
18
+ * deps: setprototypeof@1.0.3
19
+ - Fix shim for old browsers
20
+
21
+ 2017-02-14 / 1.6.0
22
+ ==================
23
+
24
+ * Accept custom 4xx and 5xx status codes in factory
25
+ * Add deprecation message to `"I'mateapot"` export
26
+ * Deprecate passing status code as anything except first argument in factory
27
+ * Deprecate using non-error status codes
28
+ * Make `message` property enumerable for `HttpError`s
29
+
30
+ 2016-11-16 / 1.5.1
31
+ ==================
32
+
33
+ * deps: inherits@2.0.3
34
+ - Fix issue loading in browser
35
+ * deps: setprototypeof@1.0.2
36
+ * deps: statuses@'>= 1.3.1 < 2'
37
+
38
+ 2016-05-18 / 1.5.0
39
+ ==================
40
+
41
+ * Support new code `421 Misdirected Request`
42
+ * Use `setprototypeof` module to replace `__proto__` setting
43
+ * deps: statuses@'>= 1.3.0 < 2'
44
+ - Add `421 Misdirected Request`
45
+ - perf: enable strict mode
46
+ * perf: enable strict mode
47
+
48
+ 2016-01-28 / 1.4.0
49
+ ==================
50
+
51
+ * Add `HttpError` export, for `err instanceof createError.HttpError`
52
+ * deps: inherits@2.0.1
53
+ * deps: statuses@'>= 1.2.1 < 2'
54
+ - Fix message for status 451
55
+ - Remove incorrect nginx status code
56
+
57
+ 2015-02-02 / 1.3.1
58
+ ==================
59
+
60
+ * Fix regression where status can be overwritten in `createError` `props`
61
+
62
+ 2015-02-01 / 1.3.0
63
+ ==================
64
+
65
+ * Construct errors using defined constructors from `createError`
66
+ * Fix error names that are not identifiers
67
+ - `createError["I'mateapot"]` is now `createError.ImATeapot`
68
+ * Set a meaningful `name` property on constructed errors
69
+
70
+ 2014-12-09 / 1.2.8
71
+ ==================
72
+
73
+ * Fix stack trace from exported function
74
+ * Remove `arguments.callee` usage
75
+
76
+ 2014-10-14 / 1.2.7
77
+ ==================
78
+
79
+ * Remove duplicate line
80
+
81
+ 2014-10-02 / 1.2.6
82
+ ==================
83
+
84
+ * Fix `expose` to be `true` for `ClientError` constructor
85
+
86
+ 2014-09-28 / 1.2.5
87
+ ==================
88
+
89
+ * deps: statuses@1
90
+
91
+ 2014-09-21 / 1.2.4
92
+ ==================
93
+
94
+ * Fix dependency version to work with old `npm`s
95
+
96
+ 2014-09-21 / 1.2.3
97
+ ==================
98
+
99
+ * deps: statuses@~1.1.0
100
+
101
+ 2014-09-21 / 1.2.2
102
+ ==================
103
+
104
+ * Fix publish error
105
+
106
+ 2014-09-21 / 1.2.1
107
+ ==================
108
+
109
+ * Support Node.js 0.6
110
+ * Use `inherits` instead of `util`
111
+
112
+ 2014-09-09 / 1.2.0
113
+ ==================
114
+
115
+ * Fix the way inheriting functions
116
+ * Support `expose` being provided in properties argument
117
+
118
+ 2014-09-08 / 1.1.0
119
+ ==================
120
+
121
+ * Default status to 500
122
+ * Support provided `error` to extend
123
+
124
+ 2014-09-08 / 1.0.1
125
+ ==================
126
+
127
+ * Fix accepting string message
128
+
129
+ 2014-09-08 / 1.0.0
130
+ ==================
131
+
132
+ * Initial release
@@ -0,0 +1,23 @@
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2014 Jonathan Ong me@jongleberry.com
5
+ Copyright (c) 2016 Douglas Christopher Wilson doug@somethingdoug.com
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
@@ -0,0 +1,135 @@
1
+ # http-errors
2
+
3
+ [![NPM Version][npm-image]][npm-url]
4
+ [![NPM Downloads][downloads-image]][downloads-url]
5
+ [![Node.js Version][node-version-image]][node-version-url]
6
+ [![Build Status][travis-image]][travis-url]
7
+ [![Test Coverage][coveralls-image]][coveralls-url]
8
+
9
+ Create HTTP errors for Express, Koa, Connect, etc. with ease.
10
+
11
+ ## Install
12
+
13
+ This is a [Node.js](https://nodejs.org/en/) module available through the
14
+ [npm registry](https://www.npmjs.com/). Installation is done using the
15
+ [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
16
+
17
+ ```bash
18
+ $ npm install http-errors
19
+ ```
20
+
21
+ ## Example
22
+
23
+ ```js
24
+ var createError = require('http-errors')
25
+ var express = require('express')
26
+ var app = express()
27
+
28
+ app.use(function (req, res, next) {
29
+ if (!req.user) return next(createError(401, 'Please login to view this page.'))
30
+ next()
31
+ })
32
+ ```
33
+
34
+ ## API
35
+
36
+ This is the current API, currently extracted from Koa and subject to change.
37
+
38
+ All errors inherit from JavaScript `Error` and the exported `createError.HttpError`.
39
+
40
+ ### Error Properties
41
+
42
+ - `expose` - can be used to signal if `message` should be sent to the client,
43
+ defaulting to `false` when `status` >= 500
44
+ - `headers` - can be an object of header names to values to be sent to the
45
+ client, defaulting to `undefined`. When defined, the key names should all
46
+ be lower-cased
47
+ - `message` - the traditional error message, which should be kept short and all
48
+ single line
49
+ - `status` - the status code of the error, mirroring `statusCode` for general
50
+ compatibility
51
+ - `statusCode` - the status code of the error, defaulting to `500`
52
+
53
+ ### createError([status], [message], [properties])
54
+
55
+ <!-- eslint-disable no-undef, no-unused-vars -->
56
+
57
+ ```js
58
+ var err = createError(404, 'This video does not exist!')
59
+ ```
60
+
61
+ - `status: 500` - the status code as a number
62
+ - `message` - the message of the error, defaulting to node's text for that status code.
63
+ - `properties` - custom properties to attach to the object
64
+
65
+ ### new createError\[code || name\](\[msg]\))
66
+
67
+ <!-- eslint-disable no-undef, no-unused-vars -->
68
+
69
+ ```js
70
+ var err = new createError.NotFound()
71
+ ```
72
+
73
+ - `code` - the status code as a number
74
+ - `name` - the name of the error as a "bumpy case", i.e. `NotFound` or `InternalServerError`.
75
+
76
+ #### List of all constructors
77
+
78
+ |Status Code|Constructor Name |
79
+ |-----------|-----------------------------|
80
+ |400 |BadRequest |
81
+ |401 |Unauthorized |
82
+ |402 |PaymentRequired |
83
+ |403 |Forbidden |
84
+ |404 |NotFound |
85
+ |405 |MethodNotAllowed |
86
+ |406 |NotAcceptable |
87
+ |407 |ProxyAuthenticationRequired |
88
+ |408 |RequestTimeout |
89
+ |409 |Conflict |
90
+ |410 |Gone |
91
+ |411 |LengthRequired |
92
+ |412 |PreconditionFailed |
93
+ |413 |PayloadTooLarge |
94
+ |414 |URITooLong |
95
+ |415 |UnsupportedMediaType |
96
+ |416 |RangeNotSatisfiable |
97
+ |417 |ExpectationFailed |
98
+ |418 |ImATeapot |
99
+ |421 |MisdirectedRequest |
100
+ |422 |UnprocessableEntity |
101
+ |423 |Locked |
102
+ |424 |FailedDependency |
103
+ |425 |UnorderedCollection |
104
+ |426 |UpgradeRequired |
105
+ |428 |PreconditionRequired |
106
+ |429 |TooManyRequests |
107
+ |431 |RequestHeaderFieldsTooLarge |
108
+ |451 |UnavailableForLegalReasons |
109
+ |500 |InternalServerError |
110
+ |501 |NotImplemented |
111
+ |502 |BadGateway |
112
+ |503 |ServiceUnavailable |
113
+ |504 |GatewayTimeout |
114
+ |505 |HTTPVersionNotSupported |
115
+ |506 |VariantAlsoNegotiates |
116
+ |507 |InsufficientStorage |
117
+ |508 |LoopDetected |
118
+ |509 |BandwidthLimitExceeded |
119
+ |510 |NotExtended |
120
+ |511 |NetworkAuthenticationRequired|
121
+
122
+ ## License
123
+
124
+ [MIT](LICENSE)
125
+
126
+ [npm-image]: https://img.shields.io/npm/v/http-errors.svg
127
+ [npm-url]: https://npmjs.org/package/http-errors
128
+ [node-version-image]: https://img.shields.io/node/v/http-errors.svg
129
+ [node-version-url]: https://nodejs.org/en/download/
130
+ [travis-image]: https://img.shields.io/travis/jshttp/http-errors.svg
131
+ [travis-url]: https://travis-ci.org/jshttp/http-errors
132
+ [coveralls-image]: https://img.shields.io/coveralls/jshttp/http-errors.svg
133
+ [coveralls-url]: https://coveralls.io/r/jshttp/http-errors
134
+ [downloads-image]: https://img.shields.io/npm/dm/http-errors.svg
135
+ [downloads-url]: https://npmjs.org/package/http-errors
@@ -0,0 +1,260 @@
1
+ /*!
2
+ * http-errors
3
+ * Copyright(c) 2014 Jonathan Ong
4
+ * Copyright(c) 2016 Douglas Christopher Wilson
5
+ * MIT Licensed
6
+ */
7
+
8
+ 'use strict'
9
+
10
+ /**
11
+ * Module dependencies.
12
+ * @private
13
+ */
14
+
15
+ var deprecate = require('depd')('http-errors')
16
+ var setPrototypeOf = require('setprototypeof')
17
+ var statuses = require('statuses')
18
+ var inherits = require('inherits')
19
+
20
+ /**
21
+ * Module exports.
22
+ * @public
23
+ */
24
+
25
+ module.exports = createError
26
+ module.exports.HttpError = createHttpErrorConstructor()
27
+
28
+ // Populate exports for all constructors
29
+ populateConstructorExports(module.exports, statuses.codes, module.exports.HttpError)
30
+
31
+ /**
32
+ * Get the code class of a status code.
33
+ * @private
34
+ */
35
+
36
+ function codeClass (status) {
37
+ return Number(String(status).charAt(0) + '00')
38
+ }
39
+
40
+ /**
41
+ * Create a new HTTP Error.
42
+ *
43
+ * @returns {Error}
44
+ * @public
45
+ */
46
+
47
+ function createError () {
48
+ // so much arity going on ~_~
49
+ var err
50
+ var msg
51
+ var status = 500
52
+ var props = {}
53
+ for (var i = 0; i < arguments.length; i++) {
54
+ var arg = arguments[i]
55
+ if (arg instanceof Error) {
56
+ err = arg
57
+ status = err.status || err.statusCode || status
58
+ continue
59
+ }
60
+ switch (typeof arg) {
61
+ case 'string':
62
+ msg = arg
63
+ break
64
+ case 'number':
65
+ status = arg
66
+ if (i !== 0) {
67
+ deprecate('non-first-argument status code; replace with createError(' + arg + ', ...)')
68
+ }
69
+ break
70
+ case 'object':
71
+ props = arg
72
+ break
73
+ }
74
+ }
75
+
76
+ if (typeof status === 'number' && (status < 400 || status >= 600)) {
77
+ deprecate('non-error status code; use only 4xx or 5xx status codes')
78
+ }
79
+
80
+ if (typeof status !== 'number' ||
81
+ (!statuses[status] && (status < 400 || status >= 600))) {
82
+ status = 500
83
+ }
84
+
85
+ // constructor
86
+ var HttpError = createError[status] || createError[codeClass(status)]
87
+
88
+ if (!err) {
89
+ // create error
90
+ err = HttpError
91
+ ? new HttpError(msg)
92
+ : new Error(msg || statuses[status])
93
+ Error.captureStackTrace(err, createError)
94
+ }
95
+
96
+ if (!HttpError || !(err instanceof HttpError) || err.status !== status) {
97
+ // add properties to generic error
98
+ err.expose = status < 500
99
+ err.status = err.statusCode = status
100
+ }
101
+
102
+ for (var key in props) {
103
+ if (key !== 'status' && key !== 'statusCode') {
104
+ err[key] = props[key]
105
+ }
106
+ }
107
+
108
+ return err
109
+ }
110
+
111
+ /**
112
+ * Create HTTP error abstract base class.
113
+ * @private
114
+ */
115
+
116
+ function createHttpErrorConstructor () {
117
+ function HttpError () {
118
+ throw new TypeError('cannot construct abstract class')
119
+ }
120
+
121
+ inherits(HttpError, Error)
122
+
123
+ return HttpError
124
+ }
125
+
126
+ /**
127
+ * Create a constructor for a client error.
128
+ * @private
129
+ */
130
+
131
+ function createClientErrorConstructor (HttpError, name, code) {
132
+ var className = name.match(/Error$/) ? name : name + 'Error'
133
+
134
+ function ClientError (message) {
135
+ // create the error object
136
+ var msg = message != null ? message : statuses[code]
137
+ var err = new Error(msg)
138
+
139
+ // capture a stack trace to the construction point
140
+ Error.captureStackTrace(err, ClientError)
141
+
142
+ // adjust the [[Prototype]]
143
+ setPrototypeOf(err, ClientError.prototype)
144
+
145
+ // redefine the error message
146
+ Object.defineProperty(err, 'message', {
147
+ enumerable: true,
148
+ configurable: true,
149
+ value: msg,
150
+ writable: true
151
+ })
152
+
153
+ // redefine the error name
154
+ Object.defineProperty(err, 'name', {
155
+ enumerable: false,
156
+ configurable: true,
157
+ value: className,
158
+ writable: true
159
+ })
160
+
161
+ return err
162
+ }
163
+
164
+ inherits(ClientError, HttpError)
165
+
166
+ ClientError.prototype.status = code
167
+ ClientError.prototype.statusCode = code
168
+ ClientError.prototype.expose = true
169
+
170
+ return ClientError
171
+ }
172
+
173
+ /**
174
+ * Create a constructor for a server error.
175
+ * @private
176
+ */
177
+
178
+ function createServerErrorConstructor (HttpError, name, code) {
179
+ var className = name.match(/Error$/) ? name : name + 'Error'
180
+
181
+ function ServerError (message) {
182
+ // create the error object
183
+ var msg = message != null ? message : statuses[code]
184
+ var err = new Error(msg)
185
+
186
+ // capture a stack trace to the construction point
187
+ Error.captureStackTrace(err, ServerError)
188
+
189
+ // adjust the [[Prototype]]
190
+ setPrototypeOf(err, ServerError.prototype)
191
+
192
+ // redefine the error message
193
+ Object.defineProperty(err, 'message', {
194
+ enumerable: true,
195
+ configurable: true,
196
+ value: msg,
197
+ writable: true
198
+ })
199
+
200
+ // redefine the error name
201
+ Object.defineProperty(err, 'name', {
202
+ enumerable: false,
203
+ configurable: true,
204
+ value: className,
205
+ writable: true
206
+ })
207
+
208
+ return err
209
+ }
210
+
211
+ inherits(ServerError, HttpError)
212
+
213
+ ServerError.prototype.status = code
214
+ ServerError.prototype.statusCode = code
215
+ ServerError.prototype.expose = false
216
+
217
+ return ServerError
218
+ }
219
+
220
+ /**
221
+ * Populate the exports object with constructors for every error class.
222
+ * @private
223
+ */
224
+
225
+ function populateConstructorExports (exports, codes, HttpError) {
226
+ codes.forEach(function forEachCode (code) {
227
+ var CodeError
228
+ var name = toIdentifier(statuses[code])
229
+
230
+ switch (codeClass(code)) {
231
+ case 400:
232
+ CodeError = createClientErrorConstructor(HttpError, name, code)
233
+ break
234
+ case 500:
235
+ CodeError = createServerErrorConstructor(HttpError, name, code)
236
+ break
237
+ }
238
+
239
+ if (CodeError) {
240
+ // export the constructor
241
+ exports[code] = CodeError
242
+ exports[name] = CodeError
243
+ }
244
+ })
245
+
246
+ // backwards-compatibility
247
+ exports["I'mateapot"] = deprecate.function(exports.ImATeapot,
248
+ '"I\'mateapot"; use "ImATeapot" instead')
249
+ }
250
+
251
+ /**
252
+ * Convert a string of words to a JavaScript identifier.
253
+ * @private
254
+ */
255
+
256
+ function toIdentifier (str) {
257
+ return str.split(' ').map(function (token) {
258
+ return token.slice(0, 1).toUpperCase() + token.slice(1)
259
+ }).join('').replace(/[^ _0-9a-z]/gi, '')
260
+ }