lib/error-handlers/string.js
function handleStringAsError(err, errorMessage) {
  var fauxError = new Error();
  var fullStack = fauxError.stack.split('\n');
  var cleanedStack = fullStack.slice(0, 1).concat(fullStack.slice(4));
  var errChecked = '';

  if (isString(err)) {
    // Replace the generic error message with the user-provided string
    cleanedStack[0] = err;
  }

  errChecked = cleanedStack.join('\n');

  errorMessage.setMessage(errChecked);
}
function handleStringAsError(err, errorMessage) {
  var fauxError = new Error();
  var fullStack = fauxError.stack.split('\n');
  var cleanedStack = fullStack.slice(0, 1).concat(fullStack.slice(4));
  var errChecked = '';

  if (isString(err)) {
    // Replace the generic error message with the user-provided string
    cleanedStack[0] = err;
  }

  errChecked = cleanedStack.join('\n');

  errorMessage.setMessage(errChecked);
}
function handleStringAsError ( err , errorMessage ) { var fauxError = new Error ( ) ; var fullStack = fauxError . stack . split ( '\n' ) ; var cleanedStack = fullStack . slice ( 0 , 1 ) . concat ( fullStack . slice ( 4 ) ) ; var errChecked = '' ; if ( isString ( err ) ) { // Replace the generic error message with the user-provided string cleanedStack [ 0 ] = err ; } errChecked = cleanedStack . join ( '\n' ) ; errorMessage . setMessage ( errChecked ) ; }
Handles validation of an error which has been indicated to be of type String.
This function will create a new instance of the Error class to produce a
stack trace for submission to the API and check to confirm that the given
value is of type string.
@function handleStringAsError
@param {String} err - the String indicated as the content of the error
@param {ErrorMessage} errorMessage - the error message instance to marshal
error information into.
@returns {Undefined} - does not return anything
Handles validation of an error which has been indicated to be of type String . This function will create a new instance of the Error class to produce a stack trace for submission to the API and check to confirm that the given value is of type string .