Skip to content

Commit

Permalink
BizCodeException 不进行异常识别处理
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin committed Jul 15, 2019
1 parent 55bde62 commit d3aec91
Showing 1 changed file with 4 additions and 6 deletions.
Expand Up @@ -3,7 +3,6 @@ package io.zhudy.kitty.restful.handlers
import io.zhudy.kitty.biz.BizCodeException
import io.zhudy.kitty.restful.AbstractRestExceptionHandler
import io.zhudy.kitty.restful.RestError
import org.springframework.core.NestedExceptionUtils
import org.springframework.core.Ordered
import org.springframework.core.annotation.Order

Expand All @@ -14,12 +13,11 @@ import org.springframework.core.annotation.Order
class BizCodeExceptionHandler : AbstractRestExceptionHandler() {

override fun handleException(ex: Exception): RestError? {
if (shouldApplyTo("io.zhudy.kitty.biz.BizCodeException", ex)) {
val e = NestedExceptionUtils.getMostSpecificCause(ex) as BizCodeException
if (ex is BizCodeException) {
return RestError(
status = e.bizCode.status,
code = e.bizCode.code,
message = e.message
status = ex.bizCode.status,
code = ex.bizCode.code,
message = ex.message
)
}
return null
Expand Down

0 comments on commit d3aec91

Please sign in to comment.