     data: {
       "taxon[name]": name,
     },
-    error: handle_ajax_error
+    error: tree_error_handler(data)
 
 handle_delete = (e, data) ->
-  last_rollback = data.rlbk
   node = data.rslt.obj
   delete_url = "#{base_url}/#{node.prop("id")}"
   if confirm(Spree.translations.are_you_sure_delete)

      type: "DELETE",
      dataType: "json",
      url: delete_url,
      error: handle_ajax_error
  else
    $.jstree.rollback(last_rollback)
    last_rollback = null

@setup_taxonomy_tree = (taxonomy_id) ->
  if taxonomy_id != undefined

base_url = null

tree_error_handler = (data) ->
  rollback = data.rlbk
  (XMLHttpRequest, textStatus, errorThrown) ->
    $.jstree.rollback(rollback)
    $("#ajax_error").show().html("<strong>#{server_error}</strong><br />" + taxonomy_tree_error)

handle_move = (e, data) ->
  position = data.rslt.cp
  node = data.rslt.o
  new_parent = data.rslt.np
