awSQL/lib/Errors.js
2024-12-07 02:42:25 +01:00

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};