Skip to content

Commit 9161ec8

Browse files
committed
Fix Android compile error
1 parent 6468fea commit 9161ec8

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

android/src/main/java/com/reactnativegrpc/GrpcModule.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public void setResponseSizeLimit(int limit) {
8585
this.handleOptionsChanged();
8686
}
8787

88+
@ReactMethod
8889
public void setKeepalive(boolean enabled, int time, int timeout) {
8990
this.keepAliveEnabled = enabled;
9091
this.keepAliveTime = time;
@@ -94,7 +95,15 @@ public void setKeepalive(boolean enabled, int time, int timeout) {
9495

9596
@ReactMethod
9697
public void unaryCall(int id, String path, ReadableMap obj, ReadableMap headers, final Promise promise) {
97-
ClientCall call = this.startGrpcCall(id, path, MethodDescriptor.MethodType.UNARY, headers);
98+
ClientCall call;
99+
100+
try {
101+
call = this.startGrpcCall(id, path, MethodDescriptor.MethodType.UNARY, headers);
102+
} catch (Exception e) {
103+
promise.reject(e);
104+
105+
return;
106+
}
98107

99108
byte[] data = Base64.decode(obj.getString("data"), Base64.NO_WRAP);
100109

0 commit comments

Comments
 (0)