mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Throwing an exception when specifying a non-existing recipe.
This commit is contained in:
@@ -27,8 +27,7 @@ namespace Orchard.Recipes.Services {
|
|||||||
|
|
||||||
public string Execute(Recipe recipe) {
|
public string Execute(Recipe recipe) {
|
||||||
if (recipe == null) {
|
if (recipe == null) {
|
||||||
Logger.Information("Cannot execute a null recipe. No work has been scheduled.");
|
throw new ArgumentNullException("recipe");
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!recipe.RecipeSteps.Any()) {
|
if (!recipe.RecipeSteps.Any()) {
|
||||||
|
|||||||
@@ -217,7 +217,12 @@ namespace Orchard.Setup.Services
|
|||||||
cultureManager.AddCulture("en-US");
|
cultureManager.AddCulture("en-US");
|
||||||
|
|
||||||
var recipeManager = environment.Resolve<IRecipeManager>();
|
var recipeManager = environment.Resolve<IRecipeManager>();
|
||||||
string executionId = recipeManager.Execute(Recipes().FirstOrDefault(r => r.Name.Equals(context.Recipe, StringComparison.OrdinalIgnoreCase)));
|
var recipe = Recipes().FirstOrDefault(r => r.Name.Equals(context.Recipe, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
if(recipe == null)
|
||||||
|
throw new OrchardException(T("The recipe '{0}' could not be found.", context.Recipe));
|
||||||
|
|
||||||
|
var executionId = recipeManager.Execute(recipe);
|
||||||
|
|
||||||
// null check: temporary fix for running setup in command line
|
// null check: temporary fix for running setup in command line
|
||||||
if (HttpContext.Current != null) {
|
if (HttpContext.Current != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user