Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
12
node_modules/err-code/.editorconfig
generated
vendored
Normal file
12
node_modules/err-code/.editorconfig
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[package.json]
|
||||
indent_size = 2
|
7
node_modules/err-code/.eslintrc.json
generated
vendored
Normal file
7
node_modules/err-code/.eslintrc.json
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"root": true,
|
||||
"extends": [
|
||||
"@satazor/eslint-config/es6",
|
||||
"@satazor/eslint-config/addons/node"
|
||||
]
|
||||
}
|
4
node_modules/err-code/.travis.yml
generated
vendored
Normal file
4
node_modules/err-code/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "4"
|
||||
- "6"
|
70
node_modules/err-code/README.md
generated
vendored
Normal file
70
node_modules/err-code/README.md
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
# err-code
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url] [![Greenkeeper badge][greenkeeper-image]][greenkeeper-url]
|
||||
|
||||
[npm-url]:https://npmjs.org/package/err-code
|
||||
[downloads-image]:http://img.shields.io/npm/dm/err-code.svg
|
||||
[npm-image]:http://img.shields.io/npm/v/err-code.svg
|
||||
[travis-url]:https://travis-ci.org/IndigoUnited/js-err-code
|
||||
[travis-image]:http://img.shields.io/travis/IndigoUnited/js-err-code/master.svg
|
||||
[david-dm-url]:https://david-dm.org/IndigoUnited/js-err-code
|
||||
[david-dm-image]:https://img.shields.io/david/IndigoUnited/js-err-code.svg
|
||||
[david-dm-dev-url]:https://david-dm.org/IndigoUnited/js-err-code?type=dev
|
||||
[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/js-err-code.svg
|
||||
[greenkeeper-image]:https://badges.greenkeeper.io/IndigoUnited/js-err-code.svg
|
||||
[greenkeeper-url]:https://greenkeeper.io/
|
||||
|
||||
Create new error instances with a code and additional properties.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```console
|
||||
$ npm install err-code
|
||||
// or
|
||||
$ bower install err-code
|
||||
```
|
||||
|
||||
The browser file is named index.umd.js which supports CommonJS, AMD and globals (errCode).
|
||||
|
||||
|
||||
## Why
|
||||
|
||||
I find myself doing this repeatedly:
|
||||
|
||||
```js
|
||||
var err = new Error('My message');
|
||||
err.code = 'SOMECODE';
|
||||
err.detail = 'Additional information about the error';
|
||||
throw err;
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Simple usage.
|
||||
|
||||
```js
|
||||
var errcode = require('err-code');
|
||||
|
||||
// fill error with message + code
|
||||
throw errcode(new Error('My message'), 'ESOMECODE');
|
||||
// fill error with message + code + props
|
||||
throw errcode(new Error('My message'), 'ESOMECODE', { detail: 'Additional information about the error' });
|
||||
// fill error with message + props
|
||||
throw errcode(new Error('My message'), { detail: 'Additional information about the error' });
|
||||
```
|
||||
|
||||
## Pre-existing fields
|
||||
|
||||
If the passed `Error` already has a `.code` field, or fields specified in the third argument to `errcode` they will be overwritten, unless the fields are read only or otherwise throw during assignment in which case a new object will be created that shares a prototype chain with the original `Error`. The `.stack` and `.message` properties will be carried over from the original error and `.code` or any passed properties will be set on it.
|
||||
|
||||
|
||||
## Tests
|
||||
|
||||
`$ npm test`
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php).
|
30
node_modules/err-code/bower.json
generated
vendored
Normal file
30
node_modules/err-code/bower.json
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "err-code",
|
||||
"version": "1.1.1",
|
||||
"description": "Create new error instances with a code and additional properties",
|
||||
"main": "index.umd.js",
|
||||
"homepage": "https://github.com/IndigoUnited/js-err-code",
|
||||
"authors": [
|
||||
"IndigoUnited <hello@indigounited.com> (http://indigounited.com)"
|
||||
],
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"error",
|
||||
"err",
|
||||
"code",
|
||||
"properties",
|
||||
"property"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
47
node_modules/err-code/index.js
generated
vendored
Normal file
47
node_modules/err-code/index.js
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
'use strict';
|
||||
|
||||
function assign(obj, props) {
|
||||
for (const key in props) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: props[key],
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function createError(err, code, props) {
|
||||
if (!err || typeof err === 'string') {
|
||||
throw new TypeError('Please pass an Error to err-code');
|
||||
}
|
||||
|
||||
if (!props) {
|
||||
props = {};
|
||||
}
|
||||
|
||||
if (typeof code === 'object') {
|
||||
props = code;
|
||||
code = undefined;
|
||||
}
|
||||
|
||||
if (code != null) {
|
||||
props.code = code;
|
||||
}
|
||||
|
||||
try {
|
||||
return assign(err, props);
|
||||
} catch (_) {
|
||||
props.message = err.message;
|
||||
props.stack = err.stack;
|
||||
|
||||
const ErrClass = function () {};
|
||||
|
||||
ErrClass.prototype = Object.create(Object.getPrototypeOf(err));
|
||||
|
||||
return assign(new ErrClass(), props);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = createError;
|
51
node_modules/err-code/index.umd.js
generated
vendored
Normal file
51
node_modules/err-code/index.umd.js
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.errCode = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
function assign(obj, props) {
|
||||
for (const key in props) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: props[key],
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function createError(err, code, props) {
|
||||
if (!err || typeof err === 'string') {
|
||||
throw new TypeError('Please pass an Error to err-code');
|
||||
}
|
||||
|
||||
if (!props) {
|
||||
props = {};
|
||||
}
|
||||
|
||||
if (typeof code === 'object') {
|
||||
props = code;
|
||||
code = undefined;
|
||||
}
|
||||
|
||||
if (code != null) {
|
||||
props.code = code;
|
||||
}
|
||||
|
||||
try {
|
||||
return assign(err, props);
|
||||
} catch (_) {
|
||||
props.message = err.message;
|
||||
props.stack = err.stack;
|
||||
|
||||
const ErrClass = function () {};
|
||||
|
||||
ErrClass.prototype = Object.create(Object.getPrototypeOf(err));
|
||||
|
||||
return assign(new ErrClass(), props);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = createError;
|
||||
|
||||
},{}]},{},[1])(1)
|
||||
});
|
34
node_modules/err-code/package.json
generated
vendored
Normal file
34
node_modules/err-code/package.json
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"name": "err-code",
|
||||
"version": "2.0.3",
|
||||
"description": "Create an error with a code",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"lint": "eslint '{*.js,test/**/*.js}' --ignore-pattern *.umd.js",
|
||||
"test": "mocha --bail",
|
||||
"browserify": "browserify -s err-code index.js > index.umd.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/IndigoUnited/js-err-code/issues/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/IndigoUnited/js-err-code.git"
|
||||
},
|
||||
"keywords": [
|
||||
"error",
|
||||
"err",
|
||||
"code",
|
||||
"properties",
|
||||
"property"
|
||||
],
|
||||
"author": "IndigoUnited <hello@indigounited.com> (http://indigounited.com)",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@satazor/eslint-config": "^3.0.0",
|
||||
"browserify": "^16.5.1",
|
||||
"eslint": "^7.2.0",
|
||||
"expect.js": "^0.3.1",
|
||||
"mocha": "^8.0.1"
|
||||
}
|
||||
}
|
5
node_modules/err-code/test/.eslintrc.json
generated
vendored
Normal file
5
node_modules/err-code/test/.eslintrc.json
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"env": {
|
||||
"mocha": true
|
||||
}
|
||||
}
|
159
node_modules/err-code/test/test.js
generated
vendored
Normal file
159
node_modules/err-code/test/test.js
generated
vendored
Normal file
|
@ -0,0 +1,159 @@
|
|||
'use strict';
|
||||
|
||||
const errcode = require('../index');
|
||||
const expect = require('expect.js');
|
||||
|
||||
describe('errcode', () => {
|
||||
describe('string as first argument', () => {
|
||||
it('should throw an error', () => {
|
||||
expect(() => { errcode('my message'); }).to.throwError((err) => {
|
||||
expect(err).to.be.a(TypeError);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('error as first argument', () => {
|
||||
it('should accept an error and do nothing', () => {
|
||||
const myErr = new Error('my message');
|
||||
const err = errcode(myErr);
|
||||
|
||||
expect(err).to.be(myErr);
|
||||
expect(err.hasOwnProperty(err.code)).to.be(false);
|
||||
});
|
||||
|
||||
it('should accept an error and add a code', () => {
|
||||
const myErr = new Error('my message');
|
||||
const err = errcode(myErr, 'ESOME');
|
||||
|
||||
expect(err).to.be(myErr);
|
||||
expect(err.code).to.be('ESOME');
|
||||
});
|
||||
|
||||
it('should accept an error object and add code & properties', () => {
|
||||
const myErr = new Error('my message');
|
||||
const err = errcode(myErr, 'ESOME', { foo: 'bar', bar: 'foo' });
|
||||
|
||||
expect(err).to.be.an(Error);
|
||||
expect(err.code).to.be('ESOME');
|
||||
expect(err.foo).to.be('bar');
|
||||
expect(err.bar).to.be('foo');
|
||||
});
|
||||
|
||||
it('should create an error object without code but with properties', () => {
|
||||
const myErr = new Error('my message');
|
||||
const err = errcode(myErr, { foo: 'bar', bar: 'foo' });
|
||||
|
||||
expect(err).to.be.an(Error);
|
||||
expect(err.code).to.be(undefined);
|
||||
expect(err.foo).to.be('bar');
|
||||
expect(err.bar).to.be('foo');
|
||||
});
|
||||
|
||||
it('should set a non-writable field', () => {
|
||||
const myErr = new Error('my message');
|
||||
|
||||
Object.defineProperty(myErr, 'code', {
|
||||
value: 'derp',
|
||||
writable: false,
|
||||
});
|
||||
const err = errcode(myErr, 'ERR_WAT');
|
||||
|
||||
expect(err).to.be.an(Error);
|
||||
expect(err.stack).to.equal(myErr.stack);
|
||||
expect(err.code).to.be('ERR_WAT');
|
||||
});
|
||||
|
||||
it('should add a code to frozen object', () => {
|
||||
const myErr = new Error('my message');
|
||||
const err = errcode(Object.freeze(myErr), 'ERR_WAT');
|
||||
|
||||
expect(err).to.be.an(Error);
|
||||
expect(err.stack).to.equal(myErr.stack);
|
||||
expect(err.code).to.be('ERR_WAT');
|
||||
});
|
||||
|
||||
it('should to set a field that throws at assignment time', () => {
|
||||
const myErr = new Error('my message');
|
||||
|
||||
Object.defineProperty(myErr, 'code', {
|
||||
enumerable: true,
|
||||
set() {
|
||||
throw new Error('Nope!');
|
||||
},
|
||||
get() {
|
||||
return 'derp';
|
||||
},
|
||||
});
|
||||
const err = errcode(myErr, 'ERR_WAT');
|
||||
|
||||
expect(err).to.be.an(Error);
|
||||
expect(err.stack).to.equal(myErr.stack);
|
||||
expect(err.code).to.be('ERR_WAT');
|
||||
});
|
||||
|
||||
it('should retain error type', () => {
|
||||
const myErr = new TypeError('my message');
|
||||
|
||||
Object.defineProperty(myErr, 'code', {
|
||||
value: 'derp',
|
||||
writable: false,
|
||||
});
|
||||
const err = errcode(myErr, 'ERR_WAT');
|
||||
|
||||
expect(err).to.be.a(TypeError);
|
||||
expect(err.stack).to.equal(myErr.stack);
|
||||
expect(err.code).to.be('ERR_WAT');
|
||||
});
|
||||
|
||||
it('should add a code to a class that extends Error', () => {
|
||||
class CustomError extends Error {
|
||||
set code(val) {
|
||||
throw new Error('Nope!');
|
||||
}
|
||||
}
|
||||
|
||||
const myErr = new CustomError('my message');
|
||||
|
||||
Object.defineProperty(myErr, 'code', {
|
||||
value: 'derp',
|
||||
writable: false,
|
||||
configurable: false,
|
||||
});
|
||||
const err = errcode(myErr, 'ERR_WAT');
|
||||
|
||||
expect(err).to.be.a(CustomError);
|
||||
expect(err.stack).to.equal(myErr.stack);
|
||||
expect(err.code).to.be('ERR_WAT');
|
||||
|
||||
// original prototype chain should be intact
|
||||
expect(() => {
|
||||
const otherErr = new CustomError('my message');
|
||||
|
||||
otherErr.code = 'derp';
|
||||
}).to.throwError();
|
||||
});
|
||||
|
||||
it('should support errors that are not Errors', () => {
|
||||
const err = errcode({
|
||||
message: 'Oh noes!',
|
||||
}, 'ERR_WAT');
|
||||
|
||||
expect(err.message).to.be('Oh noes!');
|
||||
expect(err.code).to.be('ERR_WAT');
|
||||
});
|
||||
});
|
||||
|
||||
describe('falsy first arguments', () => {
|
||||
it('should not allow passing null as the first argument', () => {
|
||||
expect(() => { errcode(null); }).to.throwError((err) => {
|
||||
expect(err).to.be.a(TypeError);
|
||||
});
|
||||
});
|
||||
|
||||
it('should not allow passing undefined as the first argument', () => {
|
||||
expect(() => { errcode(undefined); }).to.throwError((err) => {
|
||||
expect(err).to.be.a(TypeError);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue