customError
return an object forming a custom error message
@param  {String} name
@param  {Object} error
@return {Object}
2643
function customError(name, error) {
  return {
    error: error,
    message: error.message,
    name: name
  };
}
135492
function multipleErrors(errors) {
  var messages = errors.map(function(e) { return e.message; });
  return createError(
      ['Errors:'].concat(messages).join('\n- '),
      errors[0].interval);
}
532782
function clientError(err, res) {
  log('error', err.message, { stack: err.stack });
  // They know it's a 400 already, we don't need to repeat the fact that its an error.
  const message = removePrefix(err.message, ':'),
    code = 400;

  sendDefaultResponseForCode(code, message, res);
}
1251265
function getErrorMessage (err, target, defaultMsg) {
    var errMessage;
    if (err) {
        errMessage = err.toString();
    } else {
        errMessage = defaultMsg;
    }
    return errMessage.replace('%target%', target);
}
695896
function _buildError(url, status, method, response) {
    var errorData = response || {};

    errorData.status = status;
    errorData.url = url;
    errorData.method = method;

    return errorData;
  }
95854
function toError(msg, cause) {
  var err = new Error(msg);
  err.cause = cause;
  return err;
}
1079056
function CustomError(msg) {
    BaseError.call(this);
    Error.captureStackTrace(this, arguments.callee);
    this.message = msg || defaultMessage || 'An error occurred';
    this.name = name;
    this.code = code;
  }
381650
function error(exception) {
		if (typeof customErrorHandler === 'function') {
			customErrorHandler(exception);
			return;
		}
		if (globalConfig.debug) {
			throw exception;
		} else {
			application.fire('error', {
				exception: exception
			});
		}
	}
795522
function error (err, file, name, options) {
  var message = err.message
  var column = err.column
  var line = err.line
  var type = err.name
  var method = 'message'

  if (options.throws) {
    method = 'fail'
  }

  file[method](
    message,
    { line: line, column: column },
    'parseFrontMatter:' + name + ':' + type
  )
}
471145
def new_error(self, name, message) :
        ""
        result = dbus.dbus_message_new_error(self._dbobj, name.encode(), (lambda : None, lambda : message.encode())[message != None]())
        if result == None :
            raise CallFailed("dbus_message_new_error")
        #end if
        return \
            type(self)(result)
533560
function(errOrMessage, result) {
        var err = (errOrMessage instanceof Error) ? errOrMessage : new Error(errOrMessage);
        result = result || {};
        result.error = err;
        result.status = 'error';
        err.result = result;
        return err;
    }
690680
function getErrorMessage(errors) {
  if (_.isArray(errors)) {
    return _.uniq(_.pluck(errors, 'stack')).join().replace(/instance./g, '');
  } else if (errors) {
    return errors.message;
  }
}
418851
function ClientError(message, status, cause) {
    ClientError.super_.call(this, message, status || StatusCode.CLIENT_ERROR, cause);
}
826620
function makeError(code, message, data = {}) {
  const error = new Error(message);
  return Object.assign(error, {code, data});
}
606798
function (error) {

		if (error) {
			var err = new Error("set custom data for account [" + account + "] fail");
			err.name = "setUser Error";
			LOG.error('set custom data for account [' + account + '] fail', 'user');
			UTIL.safeCall(onDone, err);
		}
		else {
			LOG.warn('set custom data for account [' + account + '] success', 'user');
			UTIL.safeCall(onDone, null);
		}	
	}
1320471
function makeError(jqXHR, textStatus, errorThrown, options) {
    var Constructor = statusToError[textStatus];

    // We did not find anything in the map, which would happen if the textStatus
    // was "error". Determine whether an ``HttpError`` or an ``AjaxError`` must
    // be thrown.
    if (!Constructor) {
      Constructor = statusToError[(jqXHR.status !== 0) ? "http" : "ajax"];
    }

    return new Constructor(jqXHR, textStatus, errorThrown, options);
  }
484023
function NotFoundError(name) {
  Error.call(this);
  Error.captureStackTrace(this, arguments.callee);
  this.name = 'Middleware Not Found Error';
  this.message = name + ' not found in the current stack';
}