15 lines
420 B
JavaScript
15 lines
420 B
JavaScript
|
|
|
|
function throwTypeError(e, r){
|
|
throw new TypeError(`Expected '${e}'. Received ${r}`);
|
|
}
|
|
|
|
function throwRangeError(min,max,r){
|
|
throw new RangeError(`The argument must be between ${min} and ${max}. Received ${r}`);
|
|
}
|
|
|
|
function throwEnumError(e=[],r){
|
|
throw new RangeError(`The argument must be one of [${e.join(",")}]. Received '${r}'`);
|
|
}
|
|
|
|
module.exports = {throwTypeError, throwRangeError, throwEnumError}; |