Index: wp-admin/upload.php
===================================================================
--- wp-admin/upload.php	(revision 17378)
+++ wp-admin/upload.php	(working copy)
@@ -36,6 +36,7 @@
 			$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
 	}
 
+	$errors = array();
 	switch ( $doaction ) {
 		case 'find_detached':
 			if ( !current_user_can('edit_posts') )
@@ -92,31 +93,58 @@
 		case 'trash':
 			foreach ( (array) $post_ids as $post_id ) {
 				if ( !current_user_can( 'delete_post', $post_id ) )
-					wp_die( __( 'You are not allowed to move this post to the trash.' ) );
+					$errors[] = sprintf( __( 'You are not allowed to move the item %s to the trash.' ), get_the_title( $post_id ) );
 
 				if ( !wp_trash_post( $post_id ) )
-					wp_die( __( 'Error in moving to trash...' ) );
+					$errors[] = sprintf( __( 'Error in moving the item %s to the trash.' ), get_the_title( $post_id ) );
 			}
+			
+			if( ! empty( $errors ) ) {
+				$wp_err = new WP_Error( 'bulk_media_trash_error' );
+				foreach( $errors as $err )
+					$wp_err->add( 'bulk_media_trash_error', $err );
+				wp_die( $wp_err );
+			}
+				
 			$location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location );
 			break;
 		case 'untrash':
 			foreach ( (array) $post_ids as $post_id ) {
 				if ( !current_user_can( 'delete_post', $post_id ) )
-					wp_die( __( 'You are not allowed to move this post out of the trash.' ) );
+					$errors[] = sprintf( __( 'You are not allowed to move the item %s out of the trash.' ), get_the_title( $post_id ) );
 
 				if ( !wp_untrash_post( $post_id ) )
-					wp_die( __( 'Error in restoring from trash...' ) );
+					$errors[] = sprintf( __( 'Error in restoring the item %s from the trash.' ), get_the_title( $post_id ) );
 			}
+			
+			if( ! empty( $errors ) ) {
+				$wp_err = new WP_Error( 'bulk_media_untrash_error' );
+				foreach( $errors as $err )
+					$wp_err->add( 'bulk_media_untrash_error', $err );
+				wp_die( $wp_err );
+			}
+				
 			$location = add_query_arg( 'untrashed', count( $post_ids ), $location );
 			break;
 		case 'delete':
 			foreach ( (array) $post_ids as $post_id_del ) {
+				if( get_post( $post_id_del ) )
+					continue;
+				
 				if ( !current_user_can( 'delete_post', $post_id_del ) )
-					wp_die( __( 'You are not allowed to delete this post.' ) );
+					$errors[] = sprintf( __( 'You are not allowed to delete the item %s.' ), get_the_title( $post_id_del ) );
 
 				if ( !wp_delete_attachment( $post_id_del ) )
-					wp_die( __( 'Error in deleting...' ) );
+					$errors[] = sprintf( __( 'Error in deleting the item %s.' ), get_the_title( $post_id_del ) );
 			}
+			
+			if( ! empty( $errors ) ) {
+				$wp_err = new WP_Error( 'bulk_media_delete_error' );
+				foreach( $errors as $err )
+					$wp_err->add( 'bulk_media_delete_error', $err );
+				wp_die( $wp_err );
+			}
+			
 			$location = add_query_arg( 'deleted', count( $post_ids ), $location );
 			break;
 	}
