All files / src/lib errors.js

100% Statements 14/14
100% Branches 0/0
100% Functions 4/4
100% Lines 14/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36  1x     1x 1x   1x       1x 1x   1x       1x 1x   1x     1x 1x   1x   1x            
'use strict';
const util = require('util');
 
function CommonEnvGetOrDieAliasesException(aliases) {
  this.message = 'At least one environment variable of [{key}] MUST be defined'.replace('{key}', aliases.join(', '));
  this.name = 'CommonEnvGetOrDieAliasesException';
}
util.inherits(CommonEnvGetOrDieAliasesException, Error);
 
 
function CommonEnvGetOrDieException(key) {
  this.message = '{key} MUST be defined'.replace('{key}', key);
  this.name = 'CommonEnvGetOrDieException';
}
util.inherits(CommonEnvGetOrDieException, Error);
 
 
function CommonEnvRootConfigurationObjectException(object, prefix) {
  this.message = '{prefix} array contains a special common-env configuration object (e.g. {$default:"", $types:"" [, $aliases:""]}) where it should contains an simple object'.replace('{prefix}', prefix);
  this.name = 'CommonEnvRootConfigurationObjectException';
}
util.inherits(CommonEnvRootConfigurationObjectException, Error);
 
function CommonEnvInvalidConfiguration(key) {
  this.message = 'Invalid configuration, `$aliases` must be defined along side $default or $type in key "{key}"'.replace('{key}', key);
  this.name = 'CommonEnvInvalidConfiguration';
}
util.inherits(CommonEnvInvalidConfiguration, Error);
 
module.exports = {
  CommonEnvGetOrDieAliasesException,
  CommonEnvGetOrDieException,
  CommonEnvRootConfigurationObjectException,
  CommonEnvInvalidConfiguration
};