Tons of Solutions Engineering work done today for the rest of the CS team! Headway, Howard Hanna, Engels, Brighton, etc. Also completed Datasnippers auth flow and worked on Anthology's script. Cloned Anthology's courses (900..) and will clone Full Story on Monday.
This commit is contained in:
21
Scripts/node_modules/error-ex/LICENSE
generated
vendored
Normal file
21
Scripts/node_modules/error-ex/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 JD Ballard
|
||||
|
||||
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.
|
||||
144
Scripts/node_modules/error-ex/README.md
generated
vendored
Normal file
144
Scripts/node_modules/error-ex/README.md
generated
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
# node-error-ex [](https://travis-ci.org/Qix-/node-error-ex) [](https://coveralls.io/r/Qix-/node-error-ex)
|
||||
> Easily subclass and customize new Error types
|
||||
|
||||
## Examples
|
||||
To include in your project:
|
||||
```javascript
|
||||
var errorEx = require('error-ex');
|
||||
```
|
||||
|
||||
To create an error message type with a specific name (note, that `ErrorFn.name`
|
||||
will not reflect this):
|
||||
```javascript
|
||||
var JSONError = errorEx('JSONError');
|
||||
|
||||
var err = new JSONError('error');
|
||||
err.name; //-> JSONError
|
||||
throw err; //-> JSONError: error
|
||||
```
|
||||
|
||||
To add a stack line:
|
||||
```javascript
|
||||
var JSONError = errorEx('JSONError', {fileName: errorEx.line('in %s')});
|
||||
|
||||
var err = new JSONError('error')
|
||||
err.fileName = '/a/b/c/foo.json';
|
||||
throw err; //-> (line 2)-> in /a/b/c/foo.json
|
||||
```
|
||||
|
||||
To append to the error message:
|
||||
```javascript
|
||||
var JSONError = errorEx('JSONError', {fileName: errorEx.append('in %s')});
|
||||
|
||||
var err = new JSONError('error');
|
||||
err.fileName = '/a/b/c/foo.json';
|
||||
throw err; //-> JSONError: error in /a/b/c/foo.json
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
#### `errorEx([name], [properties])`
|
||||
Creates a new ErrorEx error type
|
||||
|
||||
- `name`: the name of the new type (appears in the error message upon throw;
|
||||
defaults to `Error.name`)
|
||||
- `properties`: if supplied, used as a key/value dictionary of properties to
|
||||
use when building up the stack message. Keys are property names that are
|
||||
looked up on the error message, and then passed to function values.
|
||||
- `line`: if specified and is a function, return value is added as a stack
|
||||
entry (error-ex will indent for you). Passed the property value given
|
||||
the key.
|
||||
- `stack`: if specified and is a function, passed the value of the property
|
||||
using the key, and the raw stack lines as a second argument. Takes no
|
||||
return value (but the stack can be modified directly).
|
||||
- `message`: if specified and is a function, return value is used as new
|
||||
`.message` value upon get. Passed the property value of the property named
|
||||
by key, and the existing message is passed as the second argument as an
|
||||
array of lines (suitable for multi-line messages).
|
||||
|
||||
Returns a constructor (Function) that can be used just like the regular Error
|
||||
constructor.
|
||||
|
||||
```javascript
|
||||
var errorEx = require('error-ex');
|
||||
|
||||
var BasicError = errorEx();
|
||||
|
||||
var NamedError = errorEx('NamedError');
|
||||
|
||||
// --
|
||||
|
||||
var AdvancedError = errorEx('AdvancedError', {
|
||||
foo: {
|
||||
line: function (value, stack) {
|
||||
if (value) {
|
||||
return 'bar ' + value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var err = new AdvancedError('hello, world');
|
||||
err.foo = 'baz';
|
||||
throw err;
|
||||
|
||||
/*
|
||||
AdvancedError: hello, world
|
||||
bar baz
|
||||
at tryReadme() (readme.js:20:1)
|
||||
*/
|
||||
```
|
||||
|
||||
#### `errorEx.line(str)`
|
||||
Creates a stack line using a delimiter
|
||||
|
||||
> This is a helper function. It is to be used in lieu of writing a value object
|
||||
> for `properties` values.
|
||||
|
||||
- `str`: The string to create
|
||||
- Use the delimiter `%s` to specify where in the string the value should go
|
||||
|
||||
```javascript
|
||||
var errorEx = require('error-ex');
|
||||
|
||||
var FileError = errorEx('FileError', {fileName: errorEx.line('in %s')});
|
||||
|
||||
var err = new FileError('problem reading file');
|
||||
err.fileName = '/a/b/c/d/foo.js';
|
||||
throw err;
|
||||
|
||||
/*
|
||||
FileError: problem reading file
|
||||
in /a/b/c/d/foo.js
|
||||
at tryReadme() (readme.js:7:1)
|
||||
*/
|
||||
```
|
||||
|
||||
#### `errorEx.append(str)`
|
||||
Appends to the `error.message` string
|
||||
|
||||
> This is a helper function. It is to be used in lieu of writing a value object
|
||||
> for `properties` values.
|
||||
|
||||
- `str`: The string to append
|
||||
- Use the delimiter `%s` to specify where in the string the value should go
|
||||
|
||||
```javascript
|
||||
var errorEx = require('error-ex');
|
||||
|
||||
var SyntaxError = errorEx('SyntaxError', {fileName: errorEx.append('in %s')});
|
||||
|
||||
var err = new SyntaxError('improper indentation');
|
||||
err.fileName = '/a/b/c/d/foo.js';
|
||||
throw err;
|
||||
|
||||
/*
|
||||
SyntaxError: improper indentation in /a/b/c/d/foo.js
|
||||
at tryReadme() (readme.js:7:1)
|
||||
*/
|
||||
```
|
||||
|
||||
## License
|
||||
Licensed under the [MIT License](http://opensource.org/licenses/MIT).
|
||||
You can find a copy of it in [LICENSE](LICENSE).
|
||||
141
Scripts/node_modules/error-ex/index.js
generated
vendored
Normal file
141
Scripts/node_modules/error-ex/index.js
generated
vendored
Normal file
@ -0,0 +1,141 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var isArrayish = require('is-arrayish');
|
||||
|
||||
var errorEx = function errorEx(name, properties) {
|
||||
if (!name || name.constructor !== String) {
|
||||
properties = name || {};
|
||||
name = Error.name;
|
||||
}
|
||||
|
||||
var errorExError = function ErrorEXError(message) {
|
||||
if (!this) {
|
||||
return new ErrorEXError(message);
|
||||
}
|
||||
|
||||
message = message instanceof Error
|
||||
? message.message
|
||||
: (message || this.message);
|
||||
|
||||
Error.call(this, message);
|
||||
Error.captureStackTrace(this, errorExError);
|
||||
|
||||
this.name = name;
|
||||
|
||||
Object.defineProperty(this, 'message', {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
get: function () {
|
||||
var newMessage = message.split(/\r?\n/g);
|
||||
|
||||
for (var key in properties) {
|
||||
if (!properties.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var modifier = properties[key];
|
||||
|
||||
if ('message' in modifier) {
|
||||
newMessage = modifier.message(this[key], newMessage) || newMessage;
|
||||
if (!isArrayish(newMessage)) {
|
||||
newMessage = [newMessage];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return newMessage.join('\n');
|
||||
},
|
||||
set: function (v) {
|
||||
message = v;
|
||||
}
|
||||
});
|
||||
|
||||
var overwrittenStack = null;
|
||||
|
||||
var stackDescriptor = Object.getOwnPropertyDescriptor(this, 'stack');
|
||||
var stackGetter = stackDescriptor.get;
|
||||
var stackValue = stackDescriptor.value;
|
||||
delete stackDescriptor.value;
|
||||
delete stackDescriptor.writable;
|
||||
|
||||
stackDescriptor.set = function (newstack) {
|
||||
overwrittenStack = newstack;
|
||||
};
|
||||
|
||||
stackDescriptor.get = function () {
|
||||
var stack = (overwrittenStack || ((stackGetter)
|
||||
? stackGetter.call(this)
|
||||
: stackValue)).split(/\r?\n+/g);
|
||||
|
||||
// starting in Node 7, the stack builder caches the message.
|
||||
// just replace it.
|
||||
if (!overwrittenStack) {
|
||||
stack[0] = this.name + ': ' + this.message;
|
||||
}
|
||||
|
||||
var lineCount = 1;
|
||||
for (var key in properties) {
|
||||
if (!properties.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var modifier = properties[key];
|
||||
|
||||
if ('line' in modifier) {
|
||||
var line = modifier.line(this[key]);
|
||||
if (line) {
|
||||
stack.splice(lineCount++, 0, ' ' + line);
|
||||
}
|
||||
}
|
||||
|
||||
if ('stack' in modifier) {
|
||||
modifier.stack(this[key], stack);
|
||||
}
|
||||
}
|
||||
|
||||
return stack.join('\n');
|
||||
};
|
||||
|
||||
Object.defineProperty(this, 'stack', stackDescriptor);
|
||||
};
|
||||
|
||||
if (Object.setPrototypeOf) {
|
||||
Object.setPrototypeOf(errorExError.prototype, Error.prototype);
|
||||
Object.setPrototypeOf(errorExError, Error);
|
||||
} else {
|
||||
util.inherits(errorExError, Error);
|
||||
}
|
||||
|
||||
return errorExError;
|
||||
};
|
||||
|
||||
errorEx.append = function (str, def) {
|
||||
return {
|
||||
message: function (v, message) {
|
||||
v = v || def;
|
||||
|
||||
if (v) {
|
||||
message[0] += ' ' + str.replace('%s', v.toString());
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
errorEx.line = function (str, def) {
|
||||
return {
|
||||
line: function (v) {
|
||||
v = v || def;
|
||||
|
||||
if (v) {
|
||||
return str.replace('%s', v.toString());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = errorEx;
|
||||
46
Scripts/node_modules/error-ex/package.json
generated
vendored
Normal file
46
Scripts/node_modules/error-ex/package.json
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "error-ex",
|
||||
"description": "Easy error subclassing and stack customization",
|
||||
"version": "1.3.2",
|
||||
"maintainers": [
|
||||
"Josh Junon <i.am.qix@gmail.com> (github.com/qix-)",
|
||||
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)"
|
||||
],
|
||||
"keywords": [
|
||||
"error",
|
||||
"errors",
|
||||
"extend",
|
||||
"extending",
|
||||
"extension",
|
||||
"subclass",
|
||||
"stack",
|
||||
"custom"
|
||||
],
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"pretest": "xo",
|
||||
"test": "mocha --compilers coffee:coffee-script/register"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"operator-linebreak": [
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"repository": "qix-/node-error-ex",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"devDependencies": {
|
||||
"coffee-script": "^1.9.3",
|
||||
"coveralls": "^2.11.2",
|
||||
"istanbul": "^0.3.17",
|
||||
"mocha": "^2.2.5",
|
||||
"should": "^7.0.1",
|
||||
"xo": "^0.7.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-arrayish": "^0.2.1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user