mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Changed to log error details in addition to file name
This commit is contained in:
@@ -36,18 +36,15 @@ namespace Orchard.Recipes.Services {
|
|||||||
var recipeLocation = Path.Combine(extension.Location, extensionId, "Recipes");
|
var recipeLocation = Path.Combine(extension.Location, extensionId, "Recipes");
|
||||||
var recipeFiles = _webSiteFolder.ListFiles(recipeLocation, true);
|
var recipeFiles = _webSiteFolder.ListFiles(recipeLocation, true);
|
||||||
|
|
||||||
recipeFiles.Where(r => r.EndsWith(".recipe.xml", StringComparison.OrdinalIgnoreCase)).ToList().ForEach(r =>
|
recipeFiles.Where(r => r.EndsWith(".recipe.xml", StringComparison.OrdinalIgnoreCase)).ToList().ForEach(r => {
|
||||||
{
|
|
||||||
var recipe = _recipeParser.ParseRecipe(_webSiteFolder.ReadFile(r));
|
|
||||||
|
|
||||||
if (recipe == null)
|
try {
|
||||||
{
|
recipes.Add(_recipeParser.ParseRecipe(_webSiteFolder.ReadFile(r)));
|
||||||
Logger.Error(new Exception(string.Format("Invalid recipe file: {0}", r)), "Invalid recipe file: {0}", r);
|
|
||||||
}
|
}
|
||||||
else
|
catch (Exception ex) {
|
||||||
{
|
Logger.Error(new Exception(string.Format("Invalid recipe file: {0}\nError: {1}", r, ex.Message)), "Invalid recipe file: {0}\nError: {1}", r, ex.Message);
|
||||||
recipes.Add(recipe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -20,21 +20,12 @@ namespace Orchard.Recipes.Services {
|
|||||||
var recipe = new Recipe();
|
var recipe = new Recipe();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (string.IsNullOrEmpty(recipeText))
|
|
||||||
{
|
if (string.IsNullOrEmpty(recipeText)) {
|
||||||
return null;
|
throw new Exception("Recipe is empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
XElement recipeTree;
|
XElement recipeTree = XElement.Parse(recipeText, LoadOptions.PreserveWhitespace);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
recipeTree = XElement.Parse(recipeText, LoadOptions.PreserveWhitespace);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var recipeSteps = new List<RecipeStep>();
|
var recipeSteps = new List<RecipeStep>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user