mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
555 B
34 lines
555 B
/**
|
|
* @author Titus Wormer
|
|
* @copyright 2015 Titus Wormer
|
|
* @license MIT
|
|
* @module bail
|
|
* @fileoverview Throw a given error.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
/* Expose. */
|
|
module.exports = bail;
|
|
|
|
/**
|
|
* Throw a given error.
|
|
*
|
|
* @example
|
|
* bail();
|
|
*
|
|
* @example
|
|
* bail(new Error('failure'));
|
|
* // Error: failure
|
|
* // at repl:1:6
|
|
* // at REPLServer.defaultEval (repl.js:154:27)
|
|
* // ...
|
|
*
|
|
* @param {Error?} [err] - Optional error.
|
|
* @throws {Error} - `err`, when given.
|
|
*/
|
|
function bail(err) {
|
|
if (err) {
|
|
throw err;
|
|
}
|
|
}
|
|
|