First step to creating common error codes.

TODO: Make A Module..
@param err
@param msg
@param code
@returns {{error: string}}
17111
function buildErrorObject(params){
  params = params || {};

  //If the userDetail is already set, not building the error object again.
  if(params.err && params.err.userDetail){
    return params;
  }

  var err = params.err || {message: "Unexpected Error"};
  var msg = params.msg || params.err.message || "Unexpected Error";
  var httpCode = params.httpCode || 500;
  //Custom Error Code
  var code = params.code || "FH-MBAAS-ERROR";

  var response = {
    errorFields: {
      userDetail: msg,
      systemDetail: msg + ' - ' + util.inspect(err),
      code: code
    },
    httpCode: httpCode
  };
  if (params.explain) {
    response.errorFields.explain = params.explain;
  }

  return response;
}
1157625
protected final void addError(String msgKey, Object... args) {
    getFlash().addErrorNow(getTextInternal(msgKey, args));
  }
137246
function createError(code, details) {
    var error = {
        code: code,
        message: errors.get(code) || "Internal Server Error"
    };

    if (details) error["data"] = details;

    return error;
}
987156
function(errMsg, err) {
      this.newline();
      doLog('*******************************************************************');
      doLog('* ERROR                                                           *');
      doLog('*******************************************************************');

      if (generalUtils.isEmpty(err)) {
        doLog(errMsg);
      } else {
        doLogError(errMsg, err);
      }
      this.newline();
    }
845452
function makeError(id, msg, err, requireModules) {
      var e = new Error(msg + "\nhttp://requirejs.org/docs/errors.html#" + id);
      e.requireType = id;
      e.requireModules = requireModules;
      if (err) {
        e.originalError = err;
      }
      return e;
    }
584663
def error(code, message, **kwargs):
        """"""
        assert code in Logger._error_code_to_exception
        exc_type, domain = Logger._error_code_to_exception[code]
        exc = exc_type(message, **kwargs)
        Logger._log(code, exc.message, ERROR, domain)
        raise exc
263289
@Override
	public void error(final String code) {
		WMessages instance = getWMessageInstance();

		if (instance != null) {
			instance.error(code);
		}
	}
1015663
public static String getValidationError(String code, Object... msgValues) {
        if (!_MESSAGES.containsKey(code))
            throw new RuntimeException("Unknown code: " + code);
        return fillMessage(_MESSAGES.get(code), msgValues);
    }
695001
public void error(final int errorCode, final String message) {
		try {
			this.response.sendError(errorCode, message);
		} catch (final IOException e) {
			e.printStackTrace();
		}
	}
18904
function createCompilerError(
  message: string,
  locations?: ?$ReadOnlyArray<Location>,
  nodes?: ?$ReadOnlyArray<ASTNode>,
): CompilerError {
  let messageWithLocations = message;
  if (locations != null) {
    const printedLocations = printLocations(locations);
    messageWithLocations =
      printedLocations.length === 0
        ? message
        : [message, ...printedLocations].join('\n\n') + '\n';
  }
  const error = new GraphQLError(
    `Internal Error: ${messageWithLocations}`,
    nodes ?? [],
  );
  return new Error(error.message);
}
358781
public function error($code, $msg, $file, $line)
    {
        $type = $this->getErrorType($code);

        $this->setParams($type, $code, $msg, $file, $line, '', 0);

        return $this->render();
    }
1035083
public static <T> ResultObject<T> getErrorResult(int code, String message) {
        return new ResultObject<>(code, message, ValueConsts.ERROR_EN);
    }
826620
function makeError(code, message, data = {}) {
  const error = new Error(message);
  return Object.assign(error, {code, data});
}
1003565
def error(self, code=500):
        
        def wrapper(handler):
            self.error_handler[int(code)] = handler
            return handler
        return wrapper
761600
function error(name, code) {

  return function (_Error) {
    _inherits(MJMLError, _Error);

    function MJMLError(message) {
      _classCallCheck(this, MJMLError);

      var _this = _possibleConstructorReturn(this, (MJMLError.__proto__ || Object.getPrototypeOf(MJMLError)).call(this, '[MJMLError] ' + name + ': ' + message));

      _this.status = code;
      return _this;
    }

    return MJMLError;
  }(Error);
}
1289947
def send_error_msgtxt(self, code, message, headers=None):
        ""
        if headers is None:
            headers = {}

        if isinstance(message, (list, tuple)):
            message = ''.join(message)
        elif isinstance(message, dict):
            message = repr(message)

        self.send_error_explain(code,
                                ''.join(("<pre>\n", cgi.escape(message), "</pre>\n")),
                                headers,
                                "text/html")
1150195
public EvalError toEvalError(
        String msg, SimpleNode node, CallStack callstack  )
    {
        if ( Interpreter.DEBUG.get() )
            printStackTrace();

        if ( msg == null )
            msg = "";
        else
            msg += ": ";
        return new EvalError( msg + this.getMessage(), node, callstack, this );
    }