This commit is contained in:
parent
fa2be029a2
commit
724d70e58b
3339 changed files with 1075535 additions and 0 deletions
4
frontend/node_modules/combine-errors/.npmignore
generated
vendored
Normal file
4
frontend/node_modules/combine-errors/.npmignore
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
support
|
||||
test
|
||||
examples
|
||||
*.sock
|
||||
35
frontend/node_modules/combine-errors/History.md
generated
vendored
Normal file
35
frontend/node_modules/combine-errors/History.md
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
3.0.3 / 2016-06-28
|
||||
==================
|
||||
|
||||
* use ES5 syntax for browser support
|
||||
|
||||
3.0.2 / 2016-06-07
|
||||
==================
|
||||
|
||||
* fix combining repeated errors and handle the stack better
|
||||
|
||||
3.0.1 / 2016-04-24
|
||||
==================
|
||||
|
||||
* use custom-error-instance
|
||||
|
||||
3.0.0 / 2016-03-25
|
||||
==================
|
||||
|
||||
* extend with a custom error
|
||||
|
||||
2.0.0 / 2016-03-23
|
||||
==================
|
||||
|
||||
* use a semicolon to separate errors :-X
|
||||
|
||||
1.0.1 / 2016-03-11
|
||||
==================
|
||||
|
||||
* quick tests and fix error.message
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
6
frontend/node_modules/combine-errors/Makefile
generated
vendored
Normal file
6
frontend/node_modules/combine-errors/Makefile
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
test:
|
||||
@./node_modules/.bin/mocha \
|
||||
--reporter spec
|
||||
|
||||
.PHONY: test
|
||||
63
frontend/node_modules/combine-errors/Readme.md
generated
vendored
Normal file
63
frontend/node_modules/combine-errors/Readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
|
||||
# combine-errors
|
||||
|
||||
Simple, dependency-free way to combine multiple errors into one.
|
||||
|
||||
This is useful for handling multiple asynchronous errors, where you want to catch all the errors and combine them to return just a single error.
|
||||
|
||||
## Features
|
||||
|
||||
- `error instanceof Error === true`
|
||||
- composable: `error([error([err1, err2]), err3])`
|
||||
- stack and message are combined in a nice way
|
||||
- array-like object, so you can access the original errors by looping over the error
|
||||
- If you just have one error, it looks exactly like raw error meaning, `error(err).message === err.message && error(err).stack === err.stack`
|
||||
- zero dependencies
|
||||
- should work in the browser, though I haven't tested it yet
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install combine-errors
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var error = require('combine-errors')
|
||||
var err = error([
|
||||
new Error('boom'),
|
||||
new Error('kablam')
|
||||
])
|
||||
throw err
|
||||
/*
|
||||
=>
|
||||
Error: boom
|
||||
at repl:2:1
|
||||
at REPLServer.defaultEval (repl.js:262:27)
|
||||
at bound (domain.js:287:14)
|
||||
at REPLServer.runBound [as eval] (domain.js:300:12)
|
||||
at REPLServer.<anonymous> (repl.js:431:12)
|
||||
at emitOne (events.js:95:20)
|
||||
at REPLServer.emit (events.js:182:7)
|
||||
at REPLServer.Interface._onLine (readline.js:211:10)
|
||||
at REPLServer.Interface._line (readline.js:550:8)
|
||||
at REPLServer.Interface._ttyWrite (readline.js:827:14)
|
||||
|
||||
Error: kablam
|
||||
at repl:3:1
|
||||
at REPLServer.defaultEval (repl.js:262:27)
|
||||
at bound (domain.js:287:14)
|
||||
at REPLServer.runBound [as eval] (domain.js:300:12)
|
||||
at REPLServer.<anonymous> (repl.js:431:12)
|
||||
at emitOne (events.js:95:20)
|
||||
at REPLServer.emit (events.js:182:7)
|
||||
at REPLServer.Interface._onLine (readline.js:211:10)
|
||||
at REPLServer.Interface._line (readline.js:550:8)
|
||||
at REPLServer.Interface._ttyWrite (readline.js:827:14)
|
||||
*/
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
46
frontend/node_modules/combine-errors/index.js
generated
vendored
Normal file
46
frontend/node_modules/combine-errors/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
'use strict'
|
||||
|
||||
/**
|
||||
* Module Dependencies
|
||||
*/
|
||||
|
||||
var Custom = require('custom-error-instance')
|
||||
var uniq = require('lodash.uniqby')
|
||||
|
||||
/**
|
||||
* Use a custom error type
|
||||
*/
|
||||
|
||||
var MultiError = Custom('MultiError')
|
||||
|
||||
/**
|
||||
* Export `Error`
|
||||
*/
|
||||
|
||||
module.exports = error
|
||||
|
||||
/**
|
||||
* Initialize an error
|
||||
*/
|
||||
|
||||
function error (errors) {
|
||||
if (!(this instanceof error)) return new error(errors)
|
||||
errors = Array.isArray(errors) ? errors : [ errors ]
|
||||
errors = uniq(errors, function (err) { return err.stack })
|
||||
if (errors.length === 1) return errors[0]
|
||||
var multierror = new MultiError({
|
||||
message: errors.map(function (err) { return err.message }).join('; '),
|
||||
errors: errors.reduce(function (errs, err) { return errs.concat(err.errors || err) }, []),
|
||||
})
|
||||
|
||||
// lazily get/set the stack
|
||||
multierror.__defineGetter__('stack', function() {
|
||||
return errors.map(function (err) { return err.stack }).join('\n\n')
|
||||
})
|
||||
|
||||
multierror.__defineSetter__('stack', function(value) {
|
||||
return [value].concat(multierror.stack).join('\n\n')
|
||||
})
|
||||
|
||||
return multierror
|
||||
}
|
||||
25
frontend/node_modules/combine-errors/package.json
generated
vendored
Normal file
25
frontend/node_modules/combine-errors/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "combine-errors",
|
||||
"version": "3.0.3",
|
||||
"description": "Combine errors into one",
|
||||
"keywords": [
|
||||
"combine",
|
||||
"errors",
|
||||
"compose",
|
||||
"error",
|
||||
"handling"
|
||||
],
|
||||
"author": "Matthew Mueller <mattmuelle@gmail.com>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/MatthewMueller/combine-errors.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"custom-error-instance": "2.1.1",
|
||||
"lodash.uniqby": "4.5.0"
|
||||
},
|
||||
"main": "index",
|
||||
"devDependencies": {
|
||||
"mocha": "2.4.5"
|
||||
}
|
||||
}
|
||||
64
frontend/node_modules/combine-errors/test.js
generated
vendored
Normal file
64
frontend/node_modules/combine-errors/test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
'use strict'
|
||||
|
||||
/**
|
||||
* Module Dependencies
|
||||
*/
|
||||
|
||||
let assert = require('assert')
|
||||
var errors = require('./')
|
||||
|
||||
/**
|
||||
* Tests
|
||||
*/
|
||||
|
||||
describe('combine-errors', function() {
|
||||
it('should pass through single errors', function() {
|
||||
var a = new TypeError('a')
|
||||
assert.ok(errors(a).message === a.message)
|
||||
assert.ok(errors(a).stack === a.stack)
|
||||
assert.ok(errors(a) instanceof Error)
|
||||
})
|
||||
|
||||
it('should create a multierror for multiple errors', function() {
|
||||
var a = new TypeError('a')
|
||||
var b = new Error('b')
|
||||
var err = errors([a, b])
|
||||
assert.ok(err instanceof Error)
|
||||
assert.equal(err.message, 'a; b')
|
||||
assert.ok(~err.stack.indexOf('TypeError: a'))
|
||||
assert.ok(~err.stack.indexOf('Error: b'))
|
||||
})
|
||||
|
||||
it('should group multiple errors that are the same into one', function() {
|
||||
var a = new TypeError('a')
|
||||
var err = errors([a, a])
|
||||
assert.ok(err instanceof Error)
|
||||
assert.equal(err.message, 'a')
|
||||
assert.ok(~err.stack.indexOf('TypeError: a'))
|
||||
})
|
||||
|
||||
it('should allow you to overwrite the message', function() {
|
||||
var a = new TypeError('a')
|
||||
var b = new Error('b')
|
||||
var err = errors([a, b])
|
||||
assert.ok(err instanceof Error)
|
||||
err.message = err.message + ' (at: file)'
|
||||
assert.equal(err.message, 'a; b (at: file)')
|
||||
assert.ok(~err.stack.indexOf('TypeError: a'))
|
||||
assert.ok(~err.stack.indexOf('Error: b'))
|
||||
})
|
||||
|
||||
it('should compose nicely', function() {
|
||||
var a = new SyntaxError('a')
|
||||
var b = new TypeError('b')
|
||||
var c = new Error('c')
|
||||
var ab = errors([a, b])
|
||||
var abc = errors([ab, c])
|
||||
abc.message = abc.message + ' (at: file)'
|
||||
assert.equal(abc.message, 'a; b; c (at: file)')
|
||||
assert.ok(~abc.stack.indexOf('SyntaxError: a'))
|
||||
assert.ok(~abc.stack.indexOf('TypeError: b'))
|
||||
assert.ok(~abc.stack.indexOf('Error: c'))
|
||||
assert.equal(abc.errors.length, 3)
|
||||
})
|
||||
})
|
||||
Reference in a new issue