Skip to content

Commit

Permalink
solve unknown exception handle
Browse files Browse the repository at this point in the history
  • Loading branch information
susanbushisan committed Oct 21, 2019
1 parent d79b006 commit 5ef3b7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ public Return handleCommonException(CommonException e) {
}

@ExceptionHandler({Exception.class})
public Return handleException(Exception e) {
public void handleException(Exception e) throws Exception {

log.warn("unknown exception," + e.getMessage(), e);
return new Return(Return.STATUS_SERVICEERR, e.getMessage());
throw e;
// return new Return(Return.STATUS_SERVICEERR, e.getMessage());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
@Configuration
public class InterceptorConfigurer implements WebMvcConfigurer {

static final String [] TOKEN_PATH = {
"/sms/email",
"/sms/sms",
"/sms/checkInfo"
};

@Bean
public TokenInterceptor getTokenInterceptor() {

Expand All @@ -23,7 +29,7 @@ public TokenInterceptor getTokenInterceptor() {
@Override
public void addInterceptors(InterceptorRegistry registry) {

registry.addInterceptor(getTokenInterceptor()).addPathPatterns("/**");
registry.addInterceptor(getTokenInterceptor()).addPathPatterns(TOKEN_PATH);
}

}

0 comments on commit 5ef3b7e

Please sign in to comment.