SupportedProperties {
get { throw new NotSupportedException(); }
}
public bool Validate(string code, string tempFilePath, INode currentPage, out string errorMessage) {
var temp = GetVirtualPathFromPhysicalPath(tempFilePath);
try {
CompileAndInstantiate(temp);
} catch (Exception exception) {
errorMessage = exception.Message;
return false;
}
errorMessage = String.Empty;
return true;
}
public string Execute(MacroModel macro, INode currentPage) {
try
{
Success = true;
return ExecuteRazor(macro, currentPage);
} catch (Exception exception)
{
Success = false;
ResultException = exception;
HttpContext.Current.Trace.Warn("umbracoMacro", string.Format("Error Loading Razor Script (file: {0}) {1} {2}", macro.Name, exception.Message, exception.StackTrace));
var loading = string.Format("Error loading Razor Script {0}", macro.ScriptName);
if (GlobalSettings.DebugMode)
loading = loading + exception.Message;
loading = loading + "
";
return loading;
}
}
#endregion
#region IMacroEngineResultStatus Members
public bool Success { get; set; }
public Exception ResultException { get; set; }
#endregion
}
}