Skip to content
This repository has been archived by the owner on Aug 9, 2020. It is now read-only.

Commit

Permalink
Replace RuntimeException to RxCacheException.
Browse files Browse the repository at this point in the history
  • Loading branch information
ipcjs committed Sep 30, 2018
1 parent 05a6c34 commit 3cfd7ce
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
8 changes: 8 additions & 0 deletions core/src/main/java/io/rx_cache2/RxCacheException.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@
*/
public final class RxCacheException extends RuntimeException {

public RxCacheException() {
super();
}

public RxCacheException(String message) {
super(message);
}

public RxCacheException(Throwable throwable) {
super(throwable);
}

public RxCacheException(String message, Throwable exception) {
super(message, exception);
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/io/rx_cache2/internal/Disk.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Map;
import javax.inject.Inject;

import io.rx_cache2.RxCacheException;
import io.rx_cache2.internal.encrypt.FileEncryptor;
import io.victoralbertos.jolyglot.JolyglotGenerics;

Expand Down Expand Up @@ -128,7 +129,7 @@ public void save(String key, Object data, boolean isEncrypted, String encryptKey
fileEncryptor.encrypt(encryptKey, new File(cacheDirectory, key));
}
} catch (Exception e) {
throw new RuntimeException(e);
throw new RxCacheException(e);
} finally {
try {
if (fileWriter != null) {
Expand Down
16 changes: 9 additions & 7 deletions runtime/src/main/java/io/rx_cache2/internal/ProxyProviders.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@

package io.rx_cache2.internal;

import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;

import io.reactivex.BackpressureStrategy;
import io.reactivex.Maybe;
import io.reactivex.Observable;
Expand All @@ -24,13 +31,8 @@
import io.rx_cache2.EncryptKey;
import io.rx_cache2.Migration;
import io.rx_cache2.MigrationCache;
import io.rx_cache2.RxCacheException;
import io.rx_cache2.SchemeMigration;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;

public final class ProxyProviders implements InvocationHandler {
private final io.rx_cache2.internal.ProcessorProviders processorProviders;
Expand Down Expand Up @@ -90,7 +92,7 @@ public List<MigrationCache> getMigrations(Class<?> providersClass) {
}

String errorMessage = method.getName() + io.rx_cache2.internal.Locale.INVALID_RETURN_TYPE;
throw new RuntimeException(errorMessage);
throw new RxCacheException(errorMessage);
}
}).blockingFirst();
}
Expand Down

0 comments on commit 3cfd7ce

Please sign in to comment.