From abd94a7f5a50f43c797a11b53549ae48fff667c3 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 10 Oct 2016 03:43:44 +0200 Subject: add node_modules to address #4364 --- node_modules/loud-rejection/api.js | 11 +++ node_modules/loud-rejection/index.js | 36 +++++++++ node_modules/loud-rejection/license | 21 +++++ node_modules/loud-rejection/package.json | 130 +++++++++++++++++++++++++++++++ node_modules/loud-rejection/readme.md | 68 ++++++++++++++++ node_modules/loud-rejection/register.js | 2 + 6 files changed, 268 insertions(+) create mode 100644 node_modules/loud-rejection/api.js create mode 100644 node_modules/loud-rejection/index.js create mode 100644 node_modules/loud-rejection/license create mode 100644 node_modules/loud-rejection/package.json create mode 100644 node_modules/loud-rejection/readme.md create mode 100644 node_modules/loud-rejection/register.js (limited to 'node_modules/loud-rejection') diff --git a/node_modules/loud-rejection/api.js b/node_modules/loud-rejection/api.js new file mode 100644 index 000000000..f6cd6a113 --- /dev/null +++ b/node_modules/loud-rejection/api.js @@ -0,0 +1,11 @@ +'use strict'; +var util = require('util'); +var currentlyUnhandled = require('currently-unhandled'); + +// WARNING: This undocumented API is subject to change. + +module.exports = util.deprecate(function (process) { + return { + currentlyUnhandled: currentlyUnhandled(process) + }; +}, 'loudRejection/api is deprecated. Use the currently-unhandled module instead.'); diff --git a/node_modules/loud-rejection/index.js b/node_modules/loud-rejection/index.js new file mode 100644 index 000000000..319b94592 --- /dev/null +++ b/node_modules/loud-rejection/index.js @@ -0,0 +1,36 @@ +'use strict'; +var util = require('util'); +var onExit = require('signal-exit'); +var currentlyUnhandled = require('currently-unhandled'); + +var installed = false; + +module.exports = function (log) { + if (installed) { + return; + } + + installed = true; + + log = log || console.error; + + var listUnhandled = currentlyUnhandled(); + + onExit(function () { + var unhandledRejections = listUnhandled(); + + if (unhandledRejections.length > 0) { + unhandledRejections.forEach(function (x) { + var err = x.reason; + + if (!(err instanceof Error)) { + err = new Error('Promise rejected with value: ' + util.inspect(err)); + } + + log(err.stack); + }); + + process.exitCode = 1; + } + }); +}; diff --git a/node_modules/loud-rejection/license b/node_modules/loud-rejection/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/loud-rejection/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.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. diff --git a/node_modules/loud-rejection/package.json b/node_modules/loud-rejection/package.json new file mode 100644 index 000000000..8c466e371 --- /dev/null +++ b/node_modules/loud-rejection/package.json @@ -0,0 +1,130 @@ +{ + "_args": [ + [ + { + "raw": "loud-rejection@^1.0.0", + "scope": null, + "escapedName": "loud-rejection", + "name": "loud-rejection", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/meow" + ] + ], + "_from": "loud-rejection@>=1.0.0 <2.0.0", + "_id": "loud-rejection@1.6.0", + "_inCache": true, + "_location": "/loud-rejection", + "_nodeVersion": "4.4.5", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/loud-rejection-1.6.0.tgz_1467583452502_0.21159938420169055" + }, + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "_npmVersion": "2.15.5", + "_phantomChildren": {}, + "_requested": { + "raw": "loud-rejection@^1.0.0", + "scope": null, + "escapedName": "loud-rejection", + "name": "loud-rejection", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/meow" + ], + "_resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "_shasum": "5b46f80147edee578870f086d04821cf998e551f", + "_shrinkwrap": null, + "_spec": "loud-rejection@^1.0.0", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/meow", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/loud-rejection/issues" + }, + "dependencies": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + }, + "description": "Make unhandled promise rejections fail loudly instead of the default silent fail", + "devDependencies": { + "ava": "*", + "bluebird": "^3.0.5", + "coveralls": "^2.11.4", + "delay": "^1.0.0", + "execa": "^0.4.0", + "get-stream": "^2.0.0", + "nyc": "^6.2.1", + "xo": "*" + }, + "directories": {}, + "dist": { + "shasum": "5b46f80147edee578870f086d04821cf998e551f", + "tarball": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "register.js", + "api.js" + ], + "gitHead": "174a9b37f0de7ed255526b506f37961f9f74bd4d", + "homepage": "https://github.com/sindresorhus/loud-rejection#readme", + "keywords": [ + "promise", + "promises", + "unhandled", + "uncaught", + "rejection", + "loud", + "fail", + "catch", + "throw", + "handler", + "exit", + "debug", + "debugging", + "verbose" + ], + "license": "MIT", + "maintainers": [ + { + "name": "jamestalmage", + "email": "james@talmage.io" + }, + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "name": "loud-rejection", + "nyc": { + "exclude": [ + "fixture.js" + ] + }, + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/loud-rejection.git" + }, + "scripts": { + "coveralls": "nyc report --reporter=text-lcov | coveralls", + "test": "xo && nyc ava" + }, + "version": "1.6.0" +} diff --git a/node_modules/loud-rejection/readme.md b/node_modules/loud-rejection/readme.md new file mode 100644 index 000000000..a97326177 --- /dev/null +++ b/node_modules/loud-rejection/readme.md @@ -0,0 +1,68 @@ +# loud-rejection [![Build Status](https://travis-ci.org/sindresorhus/loud-rejection.svg?branch=master)](https://travis-ci.org/sindresorhus/loud-rejection) [![Coverage Status](https://coveralls.io/repos/github/sindresorhus/loud-rejection/badge.svg?branch=master)](https://coveralls.io/github/sindresorhus/loud-rejection?branch=master) + +> Make unhandled promise rejections fail loudly instead of the default [silent fail](https://gist.github.com/benjamingr/0237932cee84712951a2) + +By default, promises fail silently if you don't attach a `.catch()` handler to them. + +Use this in top-level things like tests, CLI tools, apps, etc, **but not in reusable modules.**
+Not needed in the browser as unhandled promises are shown in the console. + + +## Install + +``` +$ npm install --save loud-rejection +``` + + +## Usage + +```js +const loudRejection = require('loud-rejection'); +const promiseFn = require('promise-fn'); + +// Install the unhandledRejection listeners +loudRejection(); + +promiseFn(); +``` + +Without this module it's more verbose and you might even miss some that will fail silently: + +```js +const promiseFn = require('promise-fn'); + +function error(err) { + console.error(err.stack); + process.exit(1); +} + +promiseFn().catch(error); +``` + +### Register script + +Alternatively to the above, you may simply require `loud-rejection/register` and the unhandledRejection listener will be automagically installed for you. + +This is handy for ES2015 imports: + +```js +import 'loud-rejection/register'; +``` + + +## API + +### loudRejection([log]) + +#### log + +Type: `Function`
+Default: `console.error` + +Custom logging function to print the rejected promise. Receives the error stack. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/loud-rejection/register.js b/node_modules/loud-rejection/register.js new file mode 100644 index 000000000..293481295 --- /dev/null +++ b/node_modules/loud-rejection/register.js @@ -0,0 +1,2 @@ +'use strict'; +require('./')(); -- cgit v1.2.3