public static ReliableHttpException Create(string message, Exception exception)
        {


            ReliableHttpException ex = new ReliableHttpException(message, exception);

            return ex;
        }
        public static ReliableHttpException Create(Exception exception)
        {

            if (exception is ReliableHttpException)
            {
                return (ReliableHttpException)exception;
            }

            //
            ReliableHttpException ex = new ReliableHttpException(exception);

            return ex;
        }
        public static ReliableHttpException Create(string message, Exception exception)
        {
            ReliableHttpException ex;
            if (exception.Message.Contains("The request was aborted"))
            {
                ex = new TimeoutException(message, exception);
            }
            else
            {
                ex = new ReliableHttpException(message, exception);
            }

            return ex;
        }
        public ReliableAsyncResult(ReliableAsyncCallback cb, object state, bool completed, string responseText, ReliableHttpException error)
        {

            _id = Guid.NewGuid();
            _callback = cb;
            _asyncState = state;
            _completed = completed;
            _completedSynchronously = completed;
            ResponseText = responseText;
            _error = error;
            _status = RequestNotificationStatus.Continue;
            if (_completed && (_callback != null))
            {
                _callback(this);
            }
        }
        public static ReliableHttpException Create(Exception exception)
        {

            if (exception is ReliableHttpException)
            {
                return (ReliableHttpException)exception;
            }

            ReliableHttpException ex;
            if (exception.Message.Contains("The request was aborted"))
            {
                ex = new TimeoutException(exception);
            }
            else
            {
                ex = new ReliableHttpException(exception);
            }

            return ex;
        }
 public InternalServerErrorException(ReliableHttpException exception) : base(exception)
 {
 }
 public InvalidCredentialsException(string message, ReliableHttpException exception) : base(message, exception)
 {
 }
 public InvalidCredentialsException(ReliableHttpException exception) : base(exception)
 {
 }
 public InvalidSessionException(string message, ReliableHttpException exception) : base(message, exception)
 {
 }
 public InvalidSessionException(ReliableHttpException exception) : base(exception)
 {
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ex"></param>
 public AggregateException(ReliableHttpException ex)
     : base(ex)
 {
     _exceptions.Add(ex);
 }
 public NoDataAvailableException(ReliableHttpException exception) : base(exception)
 {
 }
        /// <summary>
        /// basically a clone constructor
        /// </summary>
        /// <param name="ex"></param>
        public ReliableHttpException(string message, ReliableHttpException exception)
            : base(message)
        {
            InnerExceptionType = exception.InnerExceptionType;
            InnerStackTrace = exception.InnerStackTrace;

        }
 public InvalidJsonRequestException(string message, ReliableHttpException exception) : base(message, exception)
 {
 }
 public ParameterMissingException(string message, ReliableHttpException exception) : base(message, exception)
 {
 }
 public InvalidJsonRequestException(ReliableHttpException exception) : base(exception)
 {
 }
 public InternalServerErrorException(string message, ReliableHttpException exception) : base(message, exception)
 {
 }
 public ThrottlingException(string message, ReliableHttpException exception) : base(message, exception)
 {
 }
 public InvalidParameterTypeException(ReliableHttpException exception) : base(exception)
 {
 }
 public InvalidParameterTypeException(string message, ReliableHttpException exception) : base(message, exception)
 {
 }
 public ParameterMissingException(ReliableHttpException exception) : base(exception)
 {
 }
 internal void Complete(bool synchronous, string responseText, ReliableHttpException error, RequestNotificationStatus status)
 {
     _completed = true;
     _completedSynchronously = synchronous;
     ResponseText = responseText;
     _error = error;
     _status = status;
     if (_callback != null)
     {
         _callback(this);
     }
 }
 public ForbiddenException(string message, ReliableHttpException exception) : base(message, exception)
 {
 }
 internal void Complete(bool synchronous, string responseText, ReliableHttpException error)
 {
     Complete(synchronous, responseText, error, RequestNotificationStatus.Continue);
 }
 public ForbiddenException(ReliableHttpException exception) : base(exception)
 {
 }
        /// <summary>
        /// basically a clone constructor
        /// </summary>
        /// <param name="ex"></param>
        public ReliableHttpException(ReliableHttpException exception)
            : base(exception.Message)
        {
            InnerExceptionType = exception.InnerExceptionType;
            InnerStackTrace = exception.InnerStackTrace;

        }
 public ThrottlingException(ReliableHttpException exception) : base(exception)
 {
 }
 public NoDataAvailableException(string message, ReliableHttpException exception) : base(message, exception)
 {
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="message"></param>
 /// <param name="ex"></param>
 public AggregateException(string message, ReliableHttpException ex)
     : base(message, ex)
 {
     _exceptions.Add(ex);
 }