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 recipeFiles = _webSiteFolder.ListFiles(recipeLocation, true);
|
||||
|
||||
recipeFiles.Where(r => r.EndsWith(".recipe.xml", StringComparison.OrdinalIgnoreCase)).ToList().ForEach(r =>
|
||||
{
|
||||
var recipe = _recipeParser.ParseRecipe(_webSiteFolder.ReadFile(r));
|
||||
recipeFiles.Where(r => r.EndsWith(".recipe.xml", StringComparison.OrdinalIgnoreCase)).ToList().ForEach(r => {
|
||||
|
||||
if (recipe == null)
|
||||
{
|
||||
Logger.Error(new Exception(string.Format("Invalid recipe file: {0}", r)), "Invalid recipe file: {0}", r);
|
||||
try {
|
||||
recipes.Add(_recipeParser.ParseRecipe(_webSiteFolder.ReadFile(r)));
|
||||
}
|
||||
else
|
||||
{
|
||||
recipes.Add(recipe);
|
||||
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);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -20,21 +20,12 @@ namespace Orchard.Recipes.Services {
|
||||
var recipe = new Recipe();
|
||||
|
||||
try {
|
||||
if (string.IsNullOrEmpty(recipeText))
|
||||
{
|
||||
return null;
|
||||
|
||||
if (string.IsNullOrEmpty(recipeText)) {
|
||||
throw new Exception("Recipe is empty");
|
||||
}
|
||||
|
||||
XElement recipeTree;
|
||||
|
||||
try
|
||||
{
|
||||
recipeTree = XElement.Parse(recipeText, LoadOptions.PreserveWhitespace);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
XElement recipeTree = XElement.Parse(recipeText, LoadOptions.PreserveWhitespace);
|
||||
|
||||
var recipeSteps = new List<RecipeStep>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user