diff --git a/src/main/java/com/tale/exception/GolbalExceptionResolve.java b/src/main/java/com/tale/exception/GolbalExceptionHandler.java similarity index 52% rename from src/main/java/com/tale/exception/GolbalExceptionResolve.java rename to src/main/java/com/tale/exception/GolbalExceptionHandler.java index fc9d90a6..a5444bca 100644 --- a/src/main/java/com/tale/exception/GolbalExceptionResolve.java +++ b/src/main/java/com/tale/exception/GolbalExceptionHandler.java @@ -1,8 +1,8 @@ package com.tale.exception; -import com.blade.exception.ExceptionResolve; import com.blade.ioc.annotation.Bean; -import com.blade.mvc.hook.Signature; +import com.blade.mvc.WebContext; +import com.blade.mvc.handler.DefaultExceptionHandler; import com.blade.mvc.ui.RestResponse; import com.blade.validator.exception.ValidateException; import lombok.extern.slf4j.Slf4j; @@ -14,16 +14,17 @@ */ @Slf4j @Bean -public class GolbalExceptionResolve implements ExceptionResolve { +public class GolbalExceptionHandler extends DefaultExceptionHandler { @Override - public boolean handle(Exception e, Signature signature) { + public void handle(Exception e) { if (e instanceof ValidateException) { ValidateException validateException = (ValidateException) e; - String msg = validateException.getErrMsg(); - signature.response().json(RestResponse.fail(msg)); - return false; + String msg = validateException.getErrMsg(); + WebContext.response().json(RestResponse.fail(msg)); + } else { + super.handle(e); } - return true; } + } diff --git a/src/main/java/com/tale/service/ContentsService.java b/src/main/java/com/tale/service/ContentsService.java index f953e726..3047d104 100644 --- a/src/main/java/com/tale/service/ContentsService.java +++ b/src/main/java/com/tale/service/ContentsService.java @@ -125,11 +125,10 @@ public void updateArticle(Contents contents) { */ public void delete(int cid) { Optional contents = this.getContents(cid + ""); - contents.ifPresent(content -> Base.atomic(() -> { + contents.ifPresent(content -> { new Contents().delete(cid); new Relationships().delete("cid", cid); - return true; - })); + }); } /**