BVB Source Codes

reactide Show error.js Source code

Return Download reactide: download error.js Source code - Download reactide Source code - Type:.js
  1. 'use strict';
  2.  
  3.  
  4. var format  = require('util').format;
  5.  
  6.  
  7. var ERR_CODE = 'ARGError';
  8.  
  9. /*:nodoc:*
  10.  * argumentError(argument, message) -> TypeError
  11.  * - argument (Object): action with broken argument
  12.  * - message (String): error message
  13.  *
  14.  * Error format helper. An error from creating or using an argument
  15.  * (optional or positional). The string value of this exception
  16.  * is the message, augmented with information
  17.  * about the argument that caused it.
  18.  *
  19.  * #####Example
  20.  *
  21.  *      var argumentErrorHelper = require('./argument/error');
  22.  *      if (conflictOptionals.length > 0) {
  23.  *        throw argumentErrorHelper(
  24.  *          action,
  25.  *          format('Conflicting option string(s): %s', conflictOptionals.join(', '))
  26.  *        );
  27.  *      }
  28.  *
  29.  **/
  30. module.exports = function (argument, message) {
  31.   var argumentName = null;
  32.   var errMessage;
  33.   var err;
  34.  
  35.   if (argument.getName) {
  36.     argumentName = argument.getName();
  37.   } else {
  38.     argumentName = '' + argument;
  39.   }
  40.  
  41.   if (!argumentName) {
  42.     errMessage = message;
  43.   } else {
  44.     errMessage = format('argument "%s": %s', argumentName, message);
  45.   }
  46.  
  47.   err = new TypeError(errMessage);
  48.   err.code = ERR_CODE;
  49.   return err;
  50. };
  51.  
downloaderror.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top