Ejemplo n.º 1
0
        /// <summary>
        /// Called during Velocity merge if a reference is null
        /// </summary>
        /// <param name="type">Class that is causing the exception</param>
        /// <param name="method">method called that causes the exception</param>
        /// <param name="e">Exception thrown by the method</param>
        /// <returns>Object to return as method result</returns>
        /// <exception cref="Exception">exception to be wrapped and propagated to app</exception>
        internal Object HandleMethodException(Type type, String method, System.Exception e)
        {
            // if we don't have a handler, just throw what we were handed
            if (MethodExceptionEvent == null)
            {
                throw new VelocityException(e.Message, e);
            }

            MethodExceptionEventArgs mea = new MethodExceptionEventArgs(type, method, e);

            MethodExceptionEvent(this, mea);

            if (mea.ValueToRender == null)
            {
                throw new VelocityException(e.Message, e);
            }
            else
            {
                return(mea.ValueToRender);
            }
        }
Ejemplo n.º 2
0
		/// <summary>
		/// Called during Velocity merge if a reference is null
		/// </summary>
		/// <param name="type">Class that is causing the exception</param>
		/// <param name="method">method called that causes the exception</param>
		/// <param name="e">Exception thrown by the method</param>
		/// <returns>Object to return as method result</returns>
		/// <exception cref="Exception">exception to be wrapped and propagated to app</exception>
		internal Object HandleMethodException(Type type, String method, System.Exception e)
		{
			// if we don't have a handler, just throw what we were handed
			if (MethodExceptionEvent == null)
			{
				throw new VelocityException(e.Message, e);
			}

			MethodExceptionEventArgs mea = new MethodExceptionEventArgs(type, method, e);
			MethodExceptionEvent(this, mea);

			if (mea.ValueToRender == null)
			{
				throw new VelocityException(e.Message, e);
			}
			else
			{
				return mea.ValueToRender;
			}
		}