修复 token过期时访问网关返回500状态码
This commit is contained in:
+2
-1
@@ -3,6 +3,7 @@ package com.central.gateway.error;
|
|||||||
import org.springframework.boot.autoconfigure.web.ErrorProperties;
|
import org.springframework.boot.autoconfigure.web.ErrorProperties;
|
||||||
import org.springframework.boot.autoconfigure.web.ResourceProperties;
|
import org.springframework.boot.autoconfigure.web.ResourceProperties;
|
||||||
import org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler;
|
import org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler;
|
||||||
|
import org.springframework.boot.web.error.ErrorAttributeOptions;
|
||||||
import org.springframework.boot.web.reactive.error.ErrorAttributes;
|
import org.springframework.boot.web.reactive.error.ErrorAttributes;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -31,7 +32,7 @@ public class JsonErrorWebExceptionHandler extends DefaultErrorWebExceptionHandle
|
|||||||
* 获取异常属性
|
* 获取异常属性
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, Object> getErrorAttributes(ServerRequest request, boolean includeStackTrace) {
|
protected Map<String, Object> getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) {
|
||||||
Throwable error = super.getError(request);
|
Throwable error = super.getError(request);
|
||||||
return responseError(request, error);
|
return responseError(request, error);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user