@eluvio/elv-js-helpers
Version:
A collection of Javascript helper functions used by several Eluvio libraries.
23 lines (21 loc) • 557 B
JavaScript
/**
* Throws an exception. Used to allow terser code, e.g. replacing `if`/`else` with a ternary expression.
*
* @function
* @category Misc
* @sig String -> THROW
* @param {String} message - Error message for exception
* @returns {Nothing}
* @example
*
* 'use strict'
* const throwError = require('@eluvio/elv-js-helpers/Misc/throwError')
*
* throwError('clear and helpful error message') //=> EXCEPTION: 'clear and helpful error message'
*
*/
const throwError = message => {
throw Error(message)
}
module.exports = throwError