package com.ruoyi.web.controller.common;

import com.ruoyi.utils.MP3PlayerUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class MyExceptionHandler {
    @ExceptionHandler(RuntimeException.class)
    public ResponseEntity<String> handleRuntimeException(RuntimeException ex) {
        //播放本地提示音乐
        MP3PlayerUtils.playAudio();
        // 自定义异常处理逻辑
        return new ResponseEntity<>("Custom error message: " + ex.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
    }
}
