Skip to content

Commit 4f483ee

Browse files
committed
merge
2 parents eb41c84 + 514b948 commit 4f483ee

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

README.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@
66

77
## Error Handle Of Rxjava
88

9-
## Step 1
9+
## Download
1010

11-
```
12-
dependencies {
13-
compile 'me.jessyan:rxerrorhandler:2.0.2' //rxjava2
14-
}
15-
16-
dependencies {
17-
compile 'me.jessyan:rxerrorhandler:1.0.1' //rxjava1
18-
}
11+
``` gradle
12+
compile 'me.jessyan:rxerrorhandler:2.0.2' //rxjava2
1913
14+
compile 'me.jessyan:rxerrorhandler:1.0.1' //rxjava1
2015
```
2116

22-
## Step 2
23-
24-
```
17+
## Usage
18+
### Step 1
19+
``` java
2520
RxErrorHandler rxErrorHandler = RxErrorHandler
2621
.builder()
2722
.with(this)
28-
.responseErrorListener(new ResponseErroListener() {
23+
.responseErrorListener(new ResponseErrorListener() {
2924
@Override
3025
                   public void handleResponseError(Context context, Throwable t) {
3126
Log.w(TAG, "error handle");
27+
if (t instanceof UnknownHostException) {
28+
//Do something
29+
}else if (t instanceof SocketTimeoutException) {
30+
//Do something
31+
}//Handle other Exception
3232
}
3333
}).build();
3434
```
3535

36-
## Step 3
36+
### Step 2
3737

38-
```
38+
``` java
3939
Observable
4040
.error(new Exception("erro"))
4141
.retryWhen(new RetryWithDelay(3, 2))//retry(http connect timeout)
@@ -48,6 +48,12 @@ dependencies {
4848
});
4949
```
5050

51+
## ProGuard
52+
```
53+
-keep class me.jessyan.rxerrorhandler.** { *; }
54+
-keep interface me.jessyan.rxerrorhandler.** { *; }
55+
```
56+
5157
## About Me
5258
* **Email**: <jess.yan.effort@gmail.com>
5359
* **Home**: <http://jessyan.me>

0 commit comments

Comments
 (0)