This commit is contained in:
Administrator
2024-05-14 22:12:23 +08:00
parent e21b0fe290
commit 2959ac0d7a

View File

@@ -1,5 +1,6 @@
package com.demo.gateway.exception; package com.demo.gateway.exception;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler; import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@@ -55,8 +56,9 @@ public class GatewayExceptionHandler extends AbstractExceptionHandler implements
@Override @Override
public Mono<Void> handle(ServerWebExchange exchange, Throwable ex) { public Mono<Void> handle(ServerWebExchange exchange, Throwable ex) {
System.out.println(ex.getMessage());
JSONObject errorInfo = super.buildErrorMap(ex); JSONObject errorInfo = super.buildErrorMap(ex);
System.out.println(JSON.toJSONString(errorInfo));
if (exchange.getResponse().isCommitted()) { if (exchange.getResponse().isCommitted()) {
return Mono.error(ex); return Mono.error(ex);
} }