Index: wp-admin/admin-ajax.php
===================================================================
--- wp-admin/admin-ajax.php	(revision 6326)
+++ wp-admin/admin-ajax.php	(working copy)
@@ -199,10 +199,19 @@
 		$x->send();
 	}
 
-	if ( !$cat = wp_insert_category( $_POST ) )
+	$cat = wp_insert_category( $_POST, true );
+
+	if ( is_wp_error($cat) ) {
+		$x = new WP_Ajax_Response( array(
+			'what' => 'cat',
+			'id' => $cat
+		) );
+		$x->send();
+	}
+
+	if ( !$cat || (!$cat = get_category( $cat )) )
 		die('0');
-	if ( !$cat = get_category( $cat ) )
-		die('0');
+
 	$level = 0;
 	$cat_full_name = $cat->name;
 	$_cat = $cat;
Index: wp-admin/includes/taxonomy.php
===================================================================
--- wp-admin/includes/taxonomy.php	(revision 6326)
+++ wp-admin/includes/taxonomy.php	(working copy)
@@ -52,7 +52,7 @@
 	return wp_delete_term($cat_ID, 'category', "default=$default");
 }
 
-function wp_insert_category($catarr) {
+function wp_insert_category($catarr, $wp_error = false) {
 	global $wpdb;
 
 	extract($catarr, EXTR_SKIP);
@@ -84,8 +84,12 @@
 	else
 		$cat_ID = wp_insert_term($cat_name, 'category', $args);
 
-	if ( is_wp_error($cat_ID) )
-		return 0;
+	if ( is_wp_error($cat_ID) ) {
+		if ( $wp_error )
+			return $cat_ID;
+		else
+			return 0;
+	}
 
 	return $cat_ID['term_id'];
 }

