Skip to content

Instantly share code, notes, and snippets.

@schnell18
Created May 23, 2021 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schnell18/cf875dbc682c0fe5e142e4f53fda431b to your computer and use it in GitHub Desktop.
Save schnell18/cf875dbc682c0fe5e142e4f53fda431b to your computer and use it in GitHub Desktop.
Vim macro to convert ErrorCode to .properties file

The vim macro:

ea.��ýaldf(f,r=ldf";D0guw

converts ErrorCode:

SYSTEM_ERROR                              (1, "系统错误"),
DB_ERROR                                  (2, "数据库错误"),
PARAM_ERROR                               (10, "参数错误"),
OPTIMISTIC_LOCK_ERROR                     (100, "并发乐观锁错误"),
RESCUE_SYSTEM_NOT_FOUND                   (2000, "系统不存在"),
INTERFACE_METHOD_MUST_BY_CUSTOM_MODE      (2001, "自定义接口模式下接口和方法名称必填"),
RESCUE_SYSTEM_UNABLE_DELETE               (2002, "系统不能删除"),
SCRIPT_TYPE_NOT_SUPPORT                   (2003, "不支持的脚本类型"),
SCRIPT_EXEC_TYPE_NOT_SUPPORT              (2004, "脚本执行类型不支持"),
SCRIPT_EXEC_IP_MUST_NOT_EMPTY             (2005, "脚本执行ip不能为空"),
TASK_NOT_FOUND                            (2006, "任务不存在"),
TASK_UNABLE_TO_EXEC                       (2007, "任务不能执行"),

to .properties file:

system.error.1=系统错误
db.error.2=数据库错误
param.error.10=参数错误
optimistic.lock.error.100=并发乐观锁错误
rescue.system.not.found.2000=系统不存在
interface.method.must.by.custom.mode.2001=自定义接口模式下接口和方法名称必填
rescue.system.unable.delete.2002=系统不能删除
script.type.not.support.2003=不支持的脚本类型
script.exec.type.not.support.2004=脚本执行类型不支持
script.exec.ip.must.not.empty.2005=脚本执行ip不能为空
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment