You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by ni...@apache.org on 2005/02/04 04:03:56 UTC

cvs commit: logging-log4net/src/Util/TypeConverters ConversionNotSupportedException.cs

nicko       2005/02/03 19:03:56

  Modified:    src/Util/TypeConverters ConversionNotSupportedException.cs
  Log:
  Added support for passing nested exception to Create
  
  Revision  Changes    Path
  1.5       +19 -2     logging-log4net/src/Util/TypeConverters/ConversionNotSupportedException.cs
  
  Index: ConversionNotSupportedException.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Util/TypeConverters/ConversionNotSupportedException.cs,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ConversionNotSupportedException.cs	17 Jan 2005 20:18:50 -0000	1.4
  +++ ConversionNotSupportedException.cs	4 Feb 2005 03:03:56 -0000	1.5
  @@ -119,13 +119,30 @@
   		/// </remarks>
   		public static ConversionNotSupportedException Create(Type destinationType, object sourceValue)
   		{
  +			return Create(destinationType, sourceValue, null);
  +		}
  +
  +		/// <summary>
  +		/// Creates a new instance of the <see cref="ConversionNotSupportedException" /> class.
  +		/// </summary>
  +		/// <param name="destinationType">The conversion destination type.</param>
  +		/// <param name="sourceValue">The value to convert.</param>
  +		/// <param name="innerException">A nested exception to include.</param>
  +		/// <returns>An instance of the <see cref="ConversionNotSupportedException" />.</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Creates a new instance of the <see cref="ConversionNotSupportedException" /> class.
  +		/// </para>
  +		/// </remarks>
  +		public static ConversionNotSupportedException Create(Type destinationType, object sourceValue, Exception innerException)
  +		{
   			if (sourceValue == null)
   			{
  -				return new ConversionNotSupportedException("Cannot convert value [null] to type ["+destinationType+"]");
  +				return new ConversionNotSupportedException("Cannot convert value [null] to type ["+destinationType+"]", innerException);
   			}
   			else
   			{
  -				return new ConversionNotSupportedException("Cannot convert from type ["+sourceValue.GetType()+"] value ["+sourceValue+"] to type ["+destinationType+"]");
  +				return new ConversionNotSupportedException("Cannot convert from type ["+sourceValue.GetType()+"] value ["+sourceValue+"] to type ["+destinationType+"]", innerException);
   			}
   		}