- VoiceController: Map.of() -> Collections.singletonMap() 兼容 Java 8 - ExploreController: 补齐 takeoutService.roll() 缺失的 taste/priceRange/allergies 参数 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
18 lines
557 B
Java
18 lines
557 B
Java
package com.chowbox.config;
|
|
|
|
import com.chowbox.model.ApiResponse;
|
|
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(Exception.class)
|
|
public ApiResponse<?> handleException(Exception e) {
|
|
log.error("Unhandled exception: {}", e.getMessage(), e);
|
|
return ApiResponse.fail(500, "服务器出了点小差,请稍后再试");
|
|
}
|
|
}
|