Skip to content

Commit

Permalink
fix: revert type changes to UploadError
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshbhutkar committed Feb 14, 2025
1 parent d6f3827 commit d1c61d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/media-utils/src/utils/upload-error.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interface UploadErrorArgs {
code: string;
message: string;
file?: File;
file: File;
cause?: Error;
}

Expand All @@ -13,7 +13,7 @@ interface UploadErrorArgs {
*/
export class UploadError extends Error {
code: string;
file?: File;
file: File;

constructor( { code, message, file, cause }: UploadErrorArgs ) {
super( message, { cause } );
Expand Down
7 changes: 1 addition & 6 deletions packages/media-utils/src/utils/upload-media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@ export function uploadMedia( {
multiple = true,
}: UploadMediaArgs ) {
if ( ! multiple && filesList.length > 1 ) {
onError?.(
new UploadError( {
code: 'GENERAL',
message: __( 'Only one file can be used here.' ),
} )
);
onError?.( new Error( __( 'Only one file can be used here.' ) ) );
return;
}

Expand Down

0 comments on commit d1c61d1

Please sign in to comment.