src/errors/DJSError.js
function message(key, args) {
  if (typeof key !== 'string') throw new Error('Error message key must be a string');
  const msg = messages.get(key);
  if (!msg) throw new Error(`An invalid error message key was used: ${key}.`);
  if (typeof msg === 'function') return msg(...args);
  if (args === undefined || args.length === 0) return msg;
  args.unshift(msg);
  return String(...args);
}
function message(key, args) {
  if (typeof key !== 'string') throw new Error('Error message key must be a string');
  const msg = messages.get(key);
  if (!msg) throw new Error(`An invalid error message key was used: ${key}.`);
  if (typeof msg === 'function') return msg(...args);
  if (args === undefined || args.length === 0) return msg;
  args.unshift(msg);
  return String(...args);
}
function message ( key , args ) { if ( typeof key !== 'string' ) throw new Error ( 'Error message key must be a string' ) ; const msg = messages . get ( key ) ; if ( ! msg ) throw new Error ( ` ${ key } ` ) ; if ( typeof msg === 'function' ) return msg ( ... args ) ; if ( args === undefined || args . length === 0 ) return msg ; args . unshift ( msg ) ; return String ( ... args ) ; }
Format the message for an error.
@param {string} key Error key
@param {Array<*>} args Arguments to pass for util format or as function args
@returns {string} Formatted string
Format the message for an error .