chatgpt-java icon indicating copy to clipboard operation
chatgpt-java copied to clipboard

DynamicKeyOpenAiAuthInterceptor里面抛出的异常怎么返给前端?

Open wangpenghua opened this issue 1 year ago • 0 comments

SpringBoot 全局异常处理器

@RestControllerAdvice
public class GlobalExceptionHandler {
  	@ExceptionHandler(BaseException.class)
	public R<String> handleBaseException(BaseException ex) {
		log.info("Exception occurred: " + ex.getMessage(), ex);
		return R.failed(300,  "处理失败,请重试~");
	}
}

DynamicKeyOpenAiAuthInterceptor里面的异常是OKHTTP子线程抛出的,流式输出的时候怎么把异常返给前端?

wangpenghua avatar Jul 19 '23 11:07 wangpenghua