19 lines
609 B
Java
19 lines
609 B
Java
package com.f8q8.qywechatarchive.common.exception;
|
|
|
|
import com.f8q8.qywechatarchive.core.utils.Result;
|
|
import com.f8q8.qywechatarchive.core.utils.ResultUtils;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
|
|
@Slf4j
|
|
@RestControllerAdvice
|
|
public class GlobalExceptionHandler {
|
|
|
|
@ExceptionHandler(value = GlobalException.class)
|
|
public Result<?> handleGlobalException(GlobalException e) {
|
|
log.error(e.getMessage(), e);
|
|
return ResultUtils.error(e.getMessage());
|
|
}
|
|
}
|