fix(server): SSE 代理错误消息不再暴露原始异常信息给客户端
This commit is contained in:
@@ -168,7 +168,7 @@ public class ShortNovelServiceImpl implements ShortNovelService {
|
|||||||
errorEvent.put("type", "error");
|
errorEvent.put("type", "error");
|
||||||
JSONObject errorPayload = new JSONObject();
|
JSONObject errorPayload = new JSONObject();
|
||||||
errorPayload.put("code", "UPSTREAM_ERROR");
|
errorPayload.put("code", "UPSTREAM_ERROR");
|
||||||
errorPayload.put("message", e.getMessage() != null ? e.getMessage() : "外部服务异常");
|
errorPayload.put("message", "外部服务异常,请稍后重试");
|
||||||
errorEvent.put("payload", errorPayload);
|
errorEvent.put("payload", errorPayload);
|
||||||
emitter.send(SseEmitter.event().name("error").data(errorEvent.toJSONString()));
|
emitter.send(SseEmitter.event().name("error").data(errorEvent.toJSONString()));
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
|||||||
Reference in New Issue
Block a user