fix: return upload limit error code

This commit is contained in:
hy001 2026-05-15 13:05:56 +08:00
parent b7ac08be5d
commit 769af267ea

View File

@ -0,0 +1,16 @@
package com.red.circle.external.adapter.app.oss;
import com.red.circle.external.response.OssErrorCode;
import com.red.circle.framework.dto.ResultResponse;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
@RestControllerAdvice
public class OssUploadExceptionHandler {
@ExceptionHandler(MaxUploadSizeExceededException.class)
public ResultResponse<Void> handleMaxUploadSizeExceeded(MaxUploadSizeExceededException e) {
return ResultResponse.failure(OssErrorCode.FILE_SIZE_GREATER_THAN_100M);
}
}