Create a new custom Error constructor
761101
function ValidationError(msg, more) {
  // Pass the constructor to V8's
  // captureStackTrace to clean up the output
  Error.captureStackTrace(this, ValidationError);

  // If defined, store a custom error message
  if (msg) {
    this.message = msg;
  }

  // If defined, store more infos
  if (more) {
    this.more = more;
  }
}
339252
function recreateError(err) {
	const Class = module.exports[err.name];
	if (Class) {
		switch(err.name) {
			case "MoleculerError": return new Class(err.message, err.code, err.type, err.data);
			case "MoleculerRetryableError": return new Class(err.message, err.code, err.type, err.data);
			case "MoleculerServerError": return new Class(err.message, err.code, err.type, err.data);
			case "MoleculerClientError": return new Class(err.message, err.code, err.type, err.data);

			case "ValidationError": return new Class(err.message, err.type, err.data);

			case "ServiceNotFoundError": return new Class(err.data);
			case "ServiceNotAvailableError": return new Class(err.data);
			case "RequestTimeoutError": return new Class(err.data);
			case "RequestSkippedError": return new Class(err.data);
			case "RequestRejectedError": return new Class(err.data);
			case "QueueIsFullError": return new Class(err.data);
			case "MaxCallLevelError": return new Class(err.data);
			case "GracefulStopTimeoutError": return new Class(err.data);
			case "ProtocolVersionMismatchError": return new Class(err.data);
			case "InvalidPacketDataError": return new Class(err.data);

			case "ServiceSchemaError":
			case "BrokerOptionsError": return new Class(err.message, err.data);
		}
	}
}
678462
function createErrorHandler(verb) {
            return function(err) {
                if (!callback) { return; }
                grunt.verbose.error();
                grunt.fail.warn("Failed to " + verb + ": " + err.message);
                callbackOnce(err);
            };
        }
545806
function createErrorHandler(yargs) {
	if (!yargs) {
		yargs = Yargs;
	}
	return consoleErrorLogger.bind(undefined, console, yargs, true);
}
1046191
function createErrorHandler(opts, transform) {
  return err => {
    if ('emit' === opts.error) {
      transform.emit('error', err)
    }
    else if ('function' === typeof opts.error) {
      opts.error(err)
    }
    else {
      const message = colors.red(err.name) + '\n' + err.toString()
        .replace(/(ParseError.*)/, colors.red('$1'))
      log(message)
    }

    transform.emit('end')

    if (opts.callback) {
      opts.callback(through2())
    }
  }
}
794173
function normalizeError(err) {
  let message = 'Unknown error';

  if (err) {
    if (err instanceof Error) {
      return err;
    }

    message = err.stack || err.message || err;
  }

  return new Error(message);
}
1065674
private function createErrorHandler()
    {
        /**
         * @param int $errno
         * @param string $errstr
         * @param string $errfile
         * @param int $errline
         * @return void
         * @throws \ErrorException if error is not within the error_reporting mask.
         */
        return function ($errno, $errstr, $errfile, $errline) {
            if (! (error_reporting() & $errno)) {
                // error_reporting does not include this error
                return;
            }

            throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
        };
    }
582729
def Create(self, name):
    
    precondition.AssertType(name, Text)

    try:
      constructor = self._constructors[name]
    except KeyError:
      message = "No constructor for name '%s' has been registered"
      message %= name
      raise ValueError(message)

    instance = constructor()
    if not isinstance(instance, self._cls):
      message = ("Constructor %r for name '%s' returned instance of type %r "
                 "(expected %r)")
      message %= (constructor, name, type(instance), self._cls)
      raise TypeError(message)

    return instance
344347
public void error(Throwable error, Map<String, Object> custom) {
    error(error, custom, null);
  }
128685
function BaseError(message) {
  if (message !== undefined) {
    defineProperty(this, "message", {
      configurable: true,
      value: message,
      writable: true,
    });
  }

  var cname = this.constructor.name;
  if (cname !== undefined && cname !== this.name) {
    defineProperty(this, "name", {
      configurable: true,
      value: cname,
      writable: true,
    });
  }

  captureStackTrace(this, this.constructor);
}
1209062
def add_error(key, error, message = nil)
      if error.is_a? Symbol
        error = ErrorAtom.new(key, error, message: message)
      elsif error.is_a?(Mutations::ErrorAtom) || error.is_a?(Mutations::ErrorArray) || error.is_a?(Mutations::ErrorHash)

      else
        raise ArgumentError.new("Invalid error of kind #{error.class}")
      end

      @errors ||= ErrorHash.new
      @errors.tap do |errs|
        path = key.to_s.split(".")
        last = path.pop
        inner = path.inject(errs) do |cur_errors,part|
          cur_errors[part.to_sym] ||= ErrorHash.new
        end
        inner[last] = error
      end
    end
461052
private function constructException()
    {
        $this->details['argument_type_error'][$this->argument] = $this->details['argument_type_error']['ARG'];
        $this->details['argument_type_error'][$this->argument] = str_replace(['VAR_TYPE', 'ARG_TYPE'], [$this->argumentValueType, $this->argumentType], $this->details['argument_type_error'][$this->argument]);
        unset($this->details['argument_type_error']['ARG']);

        $this->resolution = str_replace('ARG_TYPE', $this->argumentType, $this->resolution);
    }
982477
function createErrorMessage(errorcode) {
	if (errorcode in ERRORS) {
		var args = Array.prototype.slice.call(arguments,1);
		var entry = ERRORS[errorcode];
		if (entry.argcount && entry.argcount!==args.length) {
			// this should only ever get called if we have a bug in this library
			throw new Error("Internal failure. Unexpected usage of internal command. Please report error code: "+errorcode+"(invalid args) to the developer with the following stack trace:"+new Error().stack);
		}
		return new RequestSSLError((args.length ? util.format.apply(util.format,[entry.message].concat(args)) : entry.message), errorcode);
	}
	else {
		// this should only ever get called if we have a bug in this library
		throw new Error("Internal failure. Unexpected usage of internal command. Please report error code: "+errorcode+"(invalid error code) to the developer with the following stack trace:"+new Error().stack);
	}
}
858997
function makeEventError(error) {
  var stack = error.stack.split('\n');

  stack.splice(0, 1);
  stack.forEach(function(s, i) {
    stack[i] = s.trim();
  });

  return {
    type: typeName(error),
    error: error.message,
    stack: stack.filter(function(s) {
      return s;
    })
  };
}
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;
    }
113221
function createError(message, optInterval) {
  var e;
  if (optInterval) {
    e = new Error(optInterval.getLineAndColumnMessage() + message);
    e.shortMessage = message;
    e.interval = optInterval;
  } else {
    e = new Error(message);
  }
  return e;
}
1311571
function _displayCreationError(e, errorInfo) {
        window.setTimeout(function () {
            var error = errorInfo.type,
                isFolder = errorInfo.isFolder,
                name = errorInfo.name;

            if (error === FileSystemError.ALREADY_EXISTS) {
                _showErrorDialog(ERR_TYPE_CREATE_EXISTS, isFolder, null, name);
            } else if (error === ProjectModel.ERROR_INVALID_FILENAME) {
                _showErrorDialog(ERR_TYPE_INVALID_FILENAME, isFolder, ProjectModel._invalidChars);
            } else {
                var errString = error === FileSystemError.NOT_WRITABLE ?
                        Strings.NO_MODIFICATION_ALLOWED_ERR :
                        StringUtils.format(Strings.GENERIC_ERROR, error);

                _showErrorDialog(ERR_TYPE_CREATE, isFolder, errString, name).getPromise();
            }
        }, 10);
    }