Exemple #1
0
 /// <summary>
 /// Sets the LastException of the host from an existing
 /// RazorHostContainer exception
 /// </summary>
 /// <param name="ex"></param>
 protected virtual void SetErrorException(RazorHostContainerException ex)
 {
     LastException = ex;
     if (ThrowExceptions && LastException != null)
     {
         throw LastException;
     }
 }
Exemple #2
0
        /// <summary>
        /// Sets an error message consistently
        /// </summary>
        /// <param name="message"></param>
        protected virtual void SetError(string message)
        {
            if (string.IsNullOrEmpty(message))
            {
                LastException = null;
                return;
            }

            LastException = new RazorHostContainerException(message,
                                                            Engine?.LastGeneratedCode,
                                                            Engine?.LastException,
                                                            Engine?.TemplatePerRequestConfigurationData);

            if (ThrowExceptions)
            {
                throw LastException;
            }
        }