Statistics
| Branch: | Revision:

root / trunk / hammock / src / net35 / Hammock / Retries / NetworkError.cs @ 0eea575a

History | View | Annotate | Download (725 Bytes)

1
using System;
2
using System.Net;
3

    
4
namespace Hammock.Retries
5
{
6
#if !SILVERLIGHT
7
    [Serializable]
8
#endif
9
    public class NetworkError : RetryErrorCondition
10
    {
11
        public override Predicate<Exception> RetryIf
12
        {
13
            get
14
            {
15
                return e =>
16
                           {
17
                               var we = (e as WebException);
18

    
19
                               return we != null && (we.Status != WebExceptionStatus.Success &&
20
#if !SILVERLIGHT
21
                                      we.Status != WebExceptionStatus.ProtocolError &&
22
#endif
23
                                      we.Status != WebExceptionStatus.Pending);
24
                           };
25
            }
26
        }
27
    }
28
}