RESOURCE_NOT_EXIST("404","The resource not exists.Resource is %s");
baseResult.setMessage(String.format(CommonResultCode.RESOURCE_NOT_EXIST.message, "55555555"));
"message": "The resource not exists.Resource is 55555555",
使用String.format();
baseResult.setMessage(String.format(CommonResultCode.RESOURCE_NOT_EXIST.message, "55555555"));
"message": "The resource not exists.Resource is 55555555",
使用String.format();
本文介绍了一种处理资源不存在错误的方法,通过使用String.format()函数来动态填充错误消息中的占位符,使得错误提示更加具体明确。
1534

被折叠的 条评论
为什么被折叠?



