Called when a method throws an exception. This gives the application a chance to deal with it and either return something nice, or throw. Please return what you want rendered into the output stream.
Inheritance: System.EventArgs
Ejemplo n.º 1
0
		/// <summary>
		/// Called during Velocity merge if a reference is null
		/// </summary>
		/// <param name="claz">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 propogated to app</exception>
		internal Object HandleMethodException(Type claz, String method, 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(claz, method, e);
			MethodExceptionEvent(this, mea);

			if (mea.ValueToRender != null)
				return mea.ValueToRender;
			else
				throw new VelocityException(e.Message, e);
		}
Ejemplo n.º 2
0
        internal object HandleMethodException(Type claz, string method, System.Exception e)
        {
            if (this.MethodExceptionEvent == null)
            {
                throw new VelocityException(e.Message, e);
            }
            MethodExceptionEventArgs methodExceptionEventArgs = new MethodExceptionEventArgs(claz, method, e);

            this.MethodExceptionEvent(this, methodExceptionEventArgs);
            if (methodExceptionEventArgs.ValueToRender != null)
            {
                return(methodExceptionEventArgs.ValueToRender);
            }
            throw new VelocityException(e.Message, e);
        }
Ejemplo n.º 3
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, 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);
            }
        }