package com.xuezhanmaster.common.api; import com.xuezhanmaster.common.exception.BusinessException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; @RestControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(BusinessException.class) public ApiResponse handleBusinessException(BusinessException exception) { return ApiResponse.failure(exception.getCode(), exception.getMessage()); } @ExceptionHandler(Exception.class) public ApiResponse handleGenericException(Exception exception) { return ApiResponse.failure("INTERNAL_ERROR", exception.getMessage()); } }