package com.dcs.equipment.exception.handler.device;

import com.dcs.common.core.domain.AjaxResult;
import com.dcs.equipment.exception.device.DeviceIOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author: wangpx
 * @date: 2025-07-18 14:42
 */
@RestControllerAdvice
public class GlobalDeviceExceptionHandler {
    private static final Logger log = LoggerFactory.getLogger(GlobalDeviceExceptionHandler.class);

    /**
     * 自定义业务异常
     */
    @ExceptionHandler(DeviceIOException.class)
    public AjaxResult handleCustomException(DeviceIOException e) {
        log.error(e.getMessage());
        return AjaxResult.error(e.getMessage());
    }
}
