Skip to content

Commit

Permalink
add Assert
Browse files Browse the repository at this point in the history
  • Loading branch information
fulan.zjf committed Jan 13, 2019
1 parent 5ac3bc3 commit fbebaed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
/**
* Application Exceptions can be divided into Biz Exception and Sys Exception.
*
* BizException (including ParamException) is not retry-able, while Sys Exception could be instantaneous and retry-able.
* Business Exception is not retry-able, while System Exception could be instantaneous and retry-able.
*
* So i suggest to define 3 types of ErrorCode, the format is TYPE_SCENARIO_REASON
* So i suggest to define 2 types of ErrorCode, the format is TYPE_SCENARIO_REASON
*
* TYPE: P_ Stands for Parameter
* TYPE: B_ Stands for Business
* TYPE: S_ Stands for System
*
Expand All @@ -19,15 +18,22 @@ public enum BasicErrorCode implements ErrorCodeI{
* Parameter Exception
*
* You can extend it by implementing ErrorCodeI in your Application
* For example: P_CUSTOMER_NameIsNull("P_CUSTOMER_NameIsNull","客户姓名不能为空")
* For example:
*
* P_CUSTOMER_NameIsNull("P_CUSTOMER_NameIsNull","客户姓名不能为空")
*/
P_COMMON_ERROR("P_COMMON_ERROR" , "通用的参数校验错误"),

/**
* Business Exception
*
* You can extend it by implementing ErrorCodeI in your Application
* For example: B_CUSTOMER_NameAlreadyExist("B_CUSTOMER_NameAlreadyExist","客户姓名已经存在")
* For example:
*
* <pre class="code">
* B_CUSTOMER_NameIsNull("B_CUSTOMER_NameIsNull","客户姓名不能为空")
* B_CUSTOMER_NameAlreadyExist("B_CUSTOMER_NameAlreadyExist","客户姓名已经存在")
* </pre>
*/
B_COMMON_ERROR("B_COMMON_ERROR" , "通用的业务逻辑错误"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void handleException(Command cmd, Response response, Exception exception)

private void printLog(Command cmd, Response response, Exception exception) {
if(exception instanceof BizException || exception instanceof ParamException){
//biz exception is expected, only warn it
//biz exception is expected, only warn it, 2 git remote test
logger.warn(buildErrorMsg(cmd, response));
}
else{
Expand Down

0 comments on commit fbebaed

Please sign in to comment.