yeet
This commit is contained in:
161
node_modules/errorhandler/HISTORY.md
generated
vendored
Normal file
161
node_modules/errorhandler/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,161 @@
|
||||
1.5.1 / 2019-05-08
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.3.7
|
||||
- deps: mime-types@~2.1.24
|
||||
- deps: negotiator@0.6.2
|
||||
|
||||
1.5.0 / 2016-11-15
|
||||
==================
|
||||
|
||||
* Pretty print JSON error response
|
||||
* deps: accepts@~1.3.3
|
||||
- deps: mime-types@~2.1.11
|
||||
- deps: negotiator@0.6.1
|
||||
* perf: front-load HTML template and stylesheet at middleware construction
|
||||
* perf: only load template and stylesheet once
|
||||
* perf: resolve file paths at start up
|
||||
|
||||
1.4.3 / 2016-01-17
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.3.0
|
||||
- deps: mime-types@~2.1.7
|
||||
- deps: negotiator@0.6.0
|
||||
* deps: escape-html@~1.0.3
|
||||
- perf: enable strict mode
|
||||
- perf: optimize string replacement
|
||||
- perf: use faster string coercion
|
||||
|
||||
1.4.2 / 2015-07-30
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.2.12
|
||||
- deps: mime-types@~2.1.4
|
||||
|
||||
1.4.1 / 2015-07-05
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.2.10
|
||||
- deps: mime-types@~2.1.2
|
||||
|
||||
1.4.0 / 2015-06-10
|
||||
==================
|
||||
|
||||
* Add charset to the `Content-Type` header
|
||||
* Support `statusCode` property on `Error` objects
|
||||
* deps: accepts@~1.2.9
|
||||
- deps: mime-types@~2.1.1
|
||||
- deps: negotiator@0.5.3
|
||||
- perf: avoid argument reassignment & argument slice
|
||||
- perf: avoid negotiator recursive construction
|
||||
- perf: enable strict mode
|
||||
- perf: remove unnecessary bitwise operator
|
||||
* deps: escape-html@1.0.2
|
||||
|
||||
1.3.6 / 2015-05-14
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.2.7
|
||||
- deps: mime-types@~2.0.11
|
||||
- deps: negotiator@0.5.3
|
||||
|
||||
1.3.5 / 2015-03-14
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.2.5
|
||||
- deps: mime-types@~2.0.10
|
||||
|
||||
1.3.4 / 2015-02-15
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.2.4
|
||||
- deps: mime-types@~2.0.9
|
||||
- deps: negotiator@0.5.1
|
||||
|
||||
1.3.3 / 2015-01-31
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.2.3
|
||||
- deps: mime-types@~2.0.8
|
||||
|
||||
1.3.2 / 2015-01-01
|
||||
==================
|
||||
|
||||
* Fix heading content to not include stack
|
||||
|
||||
1.3.1 / 2014-12-31
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.2.2
|
||||
- deps: mime-types@~2.0.7
|
||||
- deps: negotiator@0.5.0
|
||||
|
||||
1.3.0 / 2014-11-22
|
||||
==================
|
||||
|
||||
* Add `log` option
|
||||
|
||||
1.2.4 / 2015-01-01
|
||||
==================
|
||||
|
||||
* Fix heading content to not include stack
|
||||
|
||||
1.2.3 / 2014-11-21
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.1.3
|
||||
- deps: mime-types@~2.0.3
|
||||
|
||||
1.2.2 / 2014-10-15
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.1.2
|
||||
- Fix error when media type has invalid parameter
|
||||
- deps: negotiator@0.4.9
|
||||
|
||||
1.2.1 / 2014-10-12
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.1.1
|
||||
- deps: mime-types@~2.0.2
|
||||
- deps: negotiator@0.4.8
|
||||
|
||||
1.2.0 / 2014-09-02
|
||||
==================
|
||||
|
||||
* Display error using `util.inspect` if no other representation
|
||||
* deps: accepts@~1.1.0
|
||||
|
||||
1.1.1 / 2014-06-20
|
||||
==================
|
||||
|
||||
* deps: accepts@~1.0.4
|
||||
- use `mime-types`
|
||||
|
||||
1.1.0 / 2014-06-16
|
||||
==================
|
||||
|
||||
* Display error on console formatted like `throw`
|
||||
* Escape HTML with `escape-html` module
|
||||
* Escape HTML in stack trace
|
||||
* Escape HTML in title
|
||||
* Fix up edge cases with error sent in response
|
||||
* Set `X-Content-Type-Options: nosniff` header
|
||||
* Use accepts for negotiation
|
||||
|
||||
1.0.2 / 2014-06-05
|
||||
==================
|
||||
|
||||
* Pass on errors from reading error files
|
||||
|
||||
1.0.1 / 2014-04-29
|
||||
==================
|
||||
|
||||
* Clean up error CSS
|
||||
* Do not respond after headers sent
|
||||
|
||||
1.0.0 / 2014-03-03
|
||||
==================
|
||||
|
||||
* Genesis from `connect`
|
23
node_modules/errorhandler/LICENSE
generated
vendored
Normal file
23
node_modules/errorhandler/LICENSE
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
128
node_modules/errorhandler/README.md
generated
vendored
Normal file
128
node_modules/errorhandler/README.md
generated
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
# errorhandler
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Development-only error handler middleware.
|
||||
|
||||
This middleware is only intended to be used in a development environment, as
|
||||
the _full error stack traces and internal details of any object passed to this
|
||||
module_ will be sent back to the client when an error occurs.
|
||||
|
||||
When an object is provided to Express as an error, this module will display
|
||||
as much about this object as possible, and will do so by using content negotiation
|
||||
for the response between HTML, JSON, and plain text.
|
||||
|
||||
* When the object is a standard `Error` object, the string provided by the
|
||||
`stack` property will be returned in HTML/text responses.
|
||||
* When the object is a non-`Error` object, the result of
|
||||
[util.inspect](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||
will be returned in HTML/text responses.
|
||||
* For JSON responses, the result will be an object with all enumerable properties
|
||||
from the object in the response.
|
||||
|
||||
## Install
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install errorhandler
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
<!-- eslint-disable no-unused-vars -->
|
||||
|
||||
```js
|
||||
var errorhandler = require('errorhandler')
|
||||
```
|
||||
|
||||
### errorhandler(options)
|
||||
|
||||
Create new middleware to handle errors and respond with content negotiation.
|
||||
|
||||
#### Options
|
||||
|
||||
Error handler accepts these properties in the options object.
|
||||
|
||||
##### log
|
||||
|
||||
Provide a function to be called with the error and a string representation of
|
||||
the error. Can be used to write the error to any desired location, or set to
|
||||
`false` to only send the error back in the response. Called as
|
||||
`log(err, str, req, res)` where `err` is the `Error` object, `str` is a string
|
||||
representation of the error, `req` is the request object and `res` is the
|
||||
response object (note, this function is invoked _after_ the response has been
|
||||
written).
|
||||
|
||||
The default value for this option is `true` unless `process.env.NODE_ENV === 'test'`.
|
||||
|
||||
Possible values:
|
||||
|
||||
* `true`: Log errors using `console.error(str)`.
|
||||
* `false`: Only send the error back in the response.
|
||||
* A function: pass the error to a function for handling.
|
||||
|
||||
## Examples
|
||||
|
||||
### Simple example
|
||||
|
||||
Basic example of adding this middleware as the error handler only in development
|
||||
with `connect` (`express` also can be used in this example).
|
||||
|
||||
```js
|
||||
var connect = require('connect')
|
||||
var errorhandler = require('errorhandler')
|
||||
|
||||
var app = connect()
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// only use in development
|
||||
app.use(errorhandler())
|
||||
}
|
||||
```
|
||||
|
||||
### Custom output location
|
||||
|
||||
Sometimes you may want to output the errors to a different location than STDERR
|
||||
during development, like a system notification, for example.
|
||||
|
||||
<!-- eslint-disable handle-callback-err -->
|
||||
|
||||
```js
|
||||
var connect = require('connect')
|
||||
var errorhandler = require('errorhandler')
|
||||
var notifier = require('node-notifier')
|
||||
|
||||
var app = connect()
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// only use in development
|
||||
app.use(errorhandler({ log: errorNotification }))
|
||||
}
|
||||
|
||||
function errorNotification (err, str, req) {
|
||||
var title = 'Error in ' + req.method + ' ' + req.url
|
||||
|
||||
notifier.notify({
|
||||
title: title,
|
||||
message: str
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/errorhandler/master
|
||||
[coveralls-url]: https://coveralls.io/r/expressjs/errorhandler?branch=master
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/errorhandler
|
||||
[npm-url]: https://npmjs.org/package/errorhandler
|
||||
[npm-version-image]: https://badgen.net/npm/v/errorhandler
|
||||
[travis-image]: https://badgen.net/travis/expressjs/errorhandler/master
|
||||
[travis-url]: https://travis-ci.org/expressjs/errorhandler
|
198
node_modules/errorhandler/index.js
generated
vendored
Normal file
198
node_modules/errorhandler/index.js
generated
vendored
Normal file
@ -0,0 +1,198 @@
|
||||
/*!
|
||||
* errorhandler
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var accepts = require('accepts')
|
||||
var escapeHtml = require('escape-html')
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var util = require('util')
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var DOUBLE_SPACE_REGEXP = /\x20{2}/g
|
||||
var NEW_LINE_REGEXP = /\n/g
|
||||
var STYLESHEET = fs.readFileSync(path.join(__dirname, '/public/style.css'), 'utf8')
|
||||
var TEMPLATE = fs.readFileSync(path.join(__dirname, '/public/error.html'), 'utf8')
|
||||
var inspect = util.inspect
|
||||
var toString = Object.prototype.toString
|
||||
|
||||
/* istanbul ignore next */
|
||||
var defer = typeof setImmediate === 'function'
|
||||
? setImmediate
|
||||
: function (fn) { process.nextTick(fn.bind.apply(fn, arguments)) }
|
||||
|
||||
/**
|
||||
* Error handler:
|
||||
*
|
||||
* Development error handler, providing stack traces
|
||||
* and error message responses for requests accepting text, html,
|
||||
* or json.
|
||||
*
|
||||
* Text:
|
||||
*
|
||||
* By default, and when _text/plain_ is accepted a simple stack trace
|
||||
* or error message will be returned.
|
||||
*
|
||||
* JSON:
|
||||
*
|
||||
* When _application/json_ is accepted, connect will respond with
|
||||
* an object in the form of `{ "error": error }`.
|
||||
*
|
||||
* HTML:
|
||||
*
|
||||
* When accepted connect will output a nice html stack trace.
|
||||
*
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports = module.exports = function errorHandler (options) {
|
||||
// get environment
|
||||
var env = process.env.NODE_ENV || 'development'
|
||||
|
||||
// get options
|
||||
var opts = options || {}
|
||||
|
||||
// get log option
|
||||
var log = opts.log === undefined
|
||||
? env !== 'test'
|
||||
: opts.log
|
||||
|
||||
if (typeof log !== 'function' && typeof log !== 'boolean') {
|
||||
throw new TypeError('option log must be function or boolean')
|
||||
}
|
||||
|
||||
// default logging using console.error
|
||||
if (log === true) {
|
||||
log = logerror
|
||||
}
|
||||
|
||||
return function errorHandler (err, req, res, next) {
|
||||
// respect err.statusCode
|
||||
if (err.statusCode) {
|
||||
res.statusCode = err.statusCode
|
||||
}
|
||||
|
||||
// respect err.status
|
||||
if (err.status) {
|
||||
res.statusCode = err.status
|
||||
}
|
||||
|
||||
// default status code to 500
|
||||
if (res.statusCode < 400) {
|
||||
res.statusCode = 500
|
||||
}
|
||||
|
||||
// log the error
|
||||
var str = stringify(err)
|
||||
if (log) {
|
||||
defer(log, err, str, req, res)
|
||||
}
|
||||
|
||||
// cannot actually respond
|
||||
if (res._header) {
|
||||
return req.socket.destroy()
|
||||
}
|
||||
|
||||
// negotiate
|
||||
var accept = accepts(req)
|
||||
var type = accept.type('html', 'json', 'text')
|
||||
|
||||
// Security header for content sniffing
|
||||
res.setHeader('X-Content-Type-Options', 'nosniff')
|
||||
|
||||
// html
|
||||
if (type === 'html') {
|
||||
var isInspect = !err.stack && String(err) === toString.call(err)
|
||||
var errorHtml = !isInspect
|
||||
? escapeHtmlBlock(str.split('\n', 1)[0] || 'Error')
|
||||
: 'Error'
|
||||
var stack = !isInspect
|
||||
? String(str).split('\n').slice(1)
|
||||
: [str]
|
||||
var stackHtml = stack
|
||||
.map(function (v) { return '<li>' + escapeHtmlBlock(v) + '</li>' })
|
||||
.join('')
|
||||
var body = TEMPLATE
|
||||
.replace('{style}', STYLESHEET)
|
||||
.replace('{stack}', stackHtml)
|
||||
.replace('{title}', escapeHtml(exports.title))
|
||||
.replace('{statusCode}', res.statusCode)
|
||||
.replace(/\{error\}/g, errorHtml)
|
||||
res.setHeader('Content-Type', 'text/html; charset=utf-8')
|
||||
res.end(body)
|
||||
// json
|
||||
} else if (type === 'json') {
|
||||
var error = { message: err.message, stack: err.stack }
|
||||
for (var prop in err) error[prop] = err[prop]
|
||||
var json = JSON.stringify({ error: error }, null, 2)
|
||||
res.setHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
res.end(json)
|
||||
// plain text
|
||||
} else {
|
||||
res.setHeader('Content-Type', 'text/plain; charset=utf-8')
|
||||
res.end(str)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Template title, framework authors may override this value.
|
||||
*/
|
||||
|
||||
exports.title = 'Connect'
|
||||
|
||||
/**
|
||||
* Escape a block of HTML, preserving whitespace.
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function escapeHtmlBlock (str) {
|
||||
return escapeHtml(str)
|
||||
.replace(DOUBLE_SPACE_REGEXP, ' ')
|
||||
.replace(NEW_LINE_REGEXP, '<br>')
|
||||
}
|
||||
|
||||
/**
|
||||
* Stringify a value.
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function stringify (val) {
|
||||
var stack = val.stack
|
||||
|
||||
if (stack) {
|
||||
return String(stack)
|
||||
}
|
||||
|
||||
var str = String(val)
|
||||
|
||||
return str === toString.call(val)
|
||||
? inspect(val)
|
||||
: str
|
||||
}
|
||||
|
||||
/**
|
||||
* Log error to console.
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function logerror (err, str) {
|
||||
console.error(str || err.stack)
|
||||
}
|
43
node_modules/errorhandler/package.json
generated
vendored
Normal file
43
node_modules/errorhandler/package.json
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "errorhandler",
|
||||
"description": "Development-only error handler middleware",
|
||||
"version": "1.5.1",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "expressjs/errorhandler",
|
||||
"dependencies": {
|
||||
"accepts": "~1.3.7",
|
||||
"escape-html": "~1.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"after": "0.8.2",
|
||||
"eslint": "5.16.0",
|
||||
"eslint-config-standard": "12.0.0",
|
||||
"eslint-plugin-import": "2.17.2",
|
||||
"eslint-plugin-markdown": "1.0.0",
|
||||
"eslint-plugin-node": "8.0.1",
|
||||
"eslint-plugin-promise": "4.1.1",
|
||||
"eslint-plugin-standard": "4.0.0",
|
||||
"istanbul": "0.4.5",
|
||||
"mocha": "6.1.4",
|
||||
"supertest": "4.0.2"
|
||||
},
|
||||
"files": [
|
||||
"public/",
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||
}
|
||||
}
|
14
node_modules/errorhandler/public/error.html
generated
vendored
Normal file
14
node_modules/errorhandler/public/error.html
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>{error}</title>
|
||||
<style>{style}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<h1>{title}</h1>
|
||||
<h2><em>{statusCode}</em> {error}</h2>
|
||||
<ul id="stacktrace">{stack}</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
35
node_modules/errorhandler/public/style.css
generated
vendored
Normal file
35
node_modules/errorhandler/public/style.css
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 80px 100px;
|
||||
font: 13px "Helvetica Neue", "Lucida Grande", "Arial";
|
||||
background: #ECE9E9 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ECE9E9));
|
||||
background: #ECE9E9 -moz-linear-gradient(top, #fff, #ECE9E9);
|
||||
background-repeat: no-repeat;
|
||||
color: #555;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
h1, h2 {
|
||||
font-size: 22px;
|
||||
color: #343434;
|
||||
}
|
||||
h1 em, h2 em {
|
||||
padding: 0 5px;
|
||||
font-weight: normal;
|
||||
}
|
||||
h1 {
|
||||
font-size: 60px;
|
||||
}
|
||||
h2 {
|
||||
margin-top: 10px;
|
||||
}
|
||||
ul li {
|
||||
list-style: none;
|
||||
}
|
||||
#stacktrace {
|
||||
margin-left: 60px;
|
||||
}
|
Reference in New Issue
Block a user