Browse Source

HPCC-12631 Improve error coming back from File.DeleteLogicalFile

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Jake Smith 10 years ago
parent
commit
3a879a8d54
3 changed files with 9 additions and 6 deletions
  1. 6 4
      dali/base/dadfs.cpp
  2. 2 1
      dali/base/dadfs.hpp
  3. 1 1
      plugins/fileservices/fileservices.cpp

+ 6 - 4
dali/base/dadfs.cpp

@@ -254,6 +254,8 @@ public:
             return str.append(": Cluster already exists: ").append(errstr);
         case DFSERR_LookupConnectionTimout: 
             return str.append(": Lookup connection timeout: ").append(errstr);
+        case DFSERR_FailedToDeleteFile:
+            return str.append(": Failed to delete file: ").append(errstr);
         }
         return str.append("Unknown DFS Exception"); 
     }
@@ -7947,12 +7949,12 @@ bool CDistributedFileDirectory::removeEntry(const char *name, IUserDescriptor *u
     catch (IException *e)
     {
         // TODO: Transform removeEntry into void
-        StringBuffer msg;
+        StringBuffer msg(logicalname.get());
+        msg.append(" - cause: ");
         e->errorMessage(msg);
-        ERRLOG("Error while deleting %s: %s", logicalname.get(), msg.str());
+        ERRLOG("%s", msg.str());
         if (throwException)
-            throw;
-
+            throw new CDFS_Exception(DFSERR_FailedToDeleteFile, msg.str());
         e->Release();
         return false;
     }

+ 2 - 1
dali/base/dadfs.hpp

@@ -722,7 +722,8 @@ enum DistributedFileSystemError
     DFSERR_CannotFindPartFileCrc,
     DFSERR_ClusterNotFound,
     DFSERR_ClusterAlreadyExists,
-    DFSERR_LookupConnectionTimout       // only raised if timeout specified on lookup etc.
+    DFSERR_LookupConnectionTimout,       // only raised if timeout specified on lookup etc.
+    DFSERR_FailedToDeleteFile
 };
 
 

+ 1 - 1
plugins/fileservices/fileservices.cpp

@@ -323,7 +323,7 @@ FILESERVICES_API void FILESERVICES_CALL fsDeleteLogicalFile(ICodeContext *ctx, c
     Linked<IUserDescriptor> udesc = ctx->queryUserDescriptor();
     StringBuffer uname;
     PrintLog("Deleting NS logical file %s for user %s", lfn.str(),udesc?udesc->getUserName(uname).str():"");
-    if (queryDistributedFileDirectory().removeEntry(lfn.str(),udesc,transaction))
+    if (queryDistributedFileDirectory().removeEntry(lfn.str(),udesc,transaction, INFINITE, true))
     {
         StringBuffer s("DeleteLogicalFile ('");
         s.append(lfn);