From 82cf4540bb33ae3ff2d3044f38e7af171deae646 Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Wed, 24 Nov 2010 09:19:45 -0800 Subject: [PATCH] Make exception message more precise Work Items: 16746 --HG-- branch : dev --- src/Orchard/FileSystems/AppData/AppDataFolder.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Orchard/FileSystems/AppData/AppDataFolder.cs b/src/Orchard/FileSystems/AppData/AppDataFolder.cs index 6f0e50e09..76e876f51 100644 --- a/src/Orchard/FileSystems/AppData/AppDataFolder.cs +++ b/src/Orchard/FileSystems/AppData/AppDataFolder.cs @@ -59,13 +59,19 @@ namespace Orchard.FileSystems.AppData { // If successful, we are done... return; } - catch (Exception) { + catch { // We need to try with another extension } } - // Everything failed, throw an exception - throw new OrchardCoreException(T("Unable to make room for file \"{0}\" in \"App_Data\" folder: too many conflicts.", destinationFileName)); + // Try again with the original filename. This should throw the same exception + // we got at the very beginning. + try { + File.Delete(destinationFileName); + } + catch (Exception e) { + throw new OrchardCoreException(T("Unable to make room for file \"{0}\" in \"App_Data\" folder", destinationFileName), e); + } } ///