Apache.NMS.Util.NMSExceptionSupport.CreateMessageFormatException C# (CSharp) Method

CreateMessageFormatException() public static method

public static CreateMessageFormatException ( Exception cause ) : MessageFormatException
cause System.Exception
return MessageFormatException
        public static MessageFormatException CreateMessageFormatException(Exception cause)
        {
            string msg = cause.Message;
            if (msg == null || msg.Length == 0)
            {
                msg = cause.ToString();
            }
            MessageFormatException exception = new MessageFormatException(msg, cause);
            return exception;
        }

Usage Example

Beispiel #1
0
        public double GetDouble(string key)
        {
            Object value = GetObjectProperty(key);

            try
            {
                if (value is Double)
                {
                    return((double)value);
                }
                else if (value is Single || value is String)
                {
                    return(Convert.ToDouble(value));
                }
                else
                {
                    throw new MessageFormatException(" cannot read a double from " + value.GetType().Name);
                }
            }
            catch (FormatException ex)
            {
                throw NMSExceptionSupport.CreateMessageFormatException(ex);
            }
        }
All Usage Examples Of Apache.NMS.Util.NMSExceptionSupport::CreateMessageFormatException