[as] feat: 파일 업로드 에러 로직 수정

This commit is contained in:
2026-10-01 16:41:10 +09:00
parent d2645a9c08
commit 4167107a91
+6 -4
View File
@@ -87,12 +87,14 @@ function useTus(options: UseTusOptions = {}): UseTusReturn {
const uploadFileAsync = useCallback(
(file: File, uploadOptions?: UploadFileOptions): Promise<string> => {
if (!validateFileType(file)) {
return Promise.reject(new Error("Invalid file type"));
}
const fileKey = uploadOptions?.fileKey ?? getDefaultFileKey(file);
if (!validateFileType(file)) {
const error = new Error("Invalid file type");
options.onError?.(error, file, fileKey, null);
return Promise.reject(error);
}
setIsUploading((prev) => ({ ...prev, [fileKey]: true }));
setProgress((prev) => ({ ...prev, [fileKey]: 0 }));